search

HTML basic notes

Jan 22, 2018 am 10:45 AM
htmlBasenotes

这次给大家带来HTML的基础笔记,下面就是实战案例,一起来看一下。

一,网页基础结构:

<html>  
    <head>  
                <title>我的第一个网页</title>  
    </head>  
    <body>  
                这是我的第一个网页   
    </body>  
</html>

注意:在HTML中,标签大部分都是成对出现的。有开始就有结束

如果不是成对出现的标签,在标签的后面加上/表示结束。

二、基本标签

1、h1-h6 标题标签
2、em 斜体
3、strong 粗体
4、hr 切割线
5、br 换行
6、p 段落标签
7、  特殊符号,空格
8、> 特殊符号,>
9、< 特殊符号,10、" 特殊符号,"
11、© 特殊符号,版权符号
12、注释
13、img 图片标签

属性:src:图片的路径,alt:当图片找不到时,显示的文字
title:鼠标悬浮显示的文字
用法:

<img src="/static/imghwm/default1.png"  data-src="..."  class="lazy"   alt="..." title="..."/>

14、a 超链接标签
属性:href:链接到哪里去
用法:
链接
锚链接
先在一个位置写上
然后另一个位置写上
点击这个链接,会找到这个?所在的位置

用法:
链接到这了来
从这了链接

15、ul-li 无序列表
用法:

<ul>
<li>列表项1</li>
.......
<li>列表项n</li>
</ul>

注意:没有顺序,每一个li就是一行
默认情况下,每一个li前面都有一个实心小点

16、ol-li 有序列表
用法:

<ol>
<li>列表项1</li>
.......
<li>列表项n</li>
</ol>

就是将无序列表的实心小点换成了序号

17、dl-dt-dd定义列表
用法:

<dl>
<dt>标题1</dt>
<dd>内容1</dd>
<dt>标题2</dt>
<dd>内容2</dd>
</dl>

实现效果:
标题1
内容1
标题2
内容2

18、表单元素
a、text 单行文本框
b、password 密码框
c、radio 单选按钮
d、file 文件选择器
e、checkbox 复选框
f、select 下拉列表
g、submit 提交按钮
h、reset 重置按钮
i、textarea 文本域

用法:

j、form标签 提交标签
语法:


如果action为空,则表示提交到当前页面
method可选属性:post、get
post安全性高,提交的信息不会显示在地址栏
get安全性较低,提交的信息显示在地址栏
如果不写method属性,默认是get

k、input标签 可选值:就是表单元素a-i

l、select 下拉列表

用法:

<select>
<option>2016</option>
<option>2015</option>
<option>2014</option>
</select>

m、 关联表单

作用:点击名字这两个字,鼠标会聚焦在名字后面的文本框中

三、注意:
1、标签名应该小写
2、HTML标签应闭合(结束)
3、标签应正确嵌套

四、表单属性
1、readonly="readonly" 只读
2、disabled="disabled" 禁用

五、表格
1、什么是表格?
最简单的就是队列,表格之间,可以写东西

2、表格怎么使用?
先画一个大框,再画每一行,再画每一列

<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>

3、数据或者说是元素都可以放在td里面

4、table的一些属性:
width:设置宽度
border:边框的粗细
align:对齐方式,最常见的,center,水平对齐
valign:对齐方式,最常见的,center,上下对齐
cellspacing="20" :格子与格子之间的距离,默认值是0
cellpadding="20":内容与格子之间的距离,默认值也是0
bgcolor:更改背景颜色

5、合并:
colspan="2":合并单元格,横着合并
rowspan="2":合并单元格,竖着合并

相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

HTML文本格式化的实例详解

html里的列表标签有哪些?

html标题,段落,换行,水平线,特殊字符应该如何使用

The above is the detailed content of HTML basic notes. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools