search
HomeWeb Front-endHTML Tutorialhtml 入门_html/css_WEB-ITnose

     HTML是网页开发的基础语言,它用来定制各种网页的元素。比如输入框,按钮、文字、标题等等元素都是有html来定义的。

    先来看一个html的框架

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <!--定义网页标签页的内容-->    <title></title></head><body><!--网页的全部内容--></body></html>

就是告诉服务器这个页面是一个html代码文档。这个必须有,虽然还有别的文档格式,但是这种这种写法兼容性最好。


标签提供有关页面的元信息,例:页面编码、刷新、跳转、针对搜索引擎和更新频度的描述和关键词


页面编码(告诉浏览器是什么编码)


刷新和跳转



关键词


描述

例如:cnblogs


X-UA-Compatible

微软的IE6是通过XP、Win2003等操作系统发布出来,作为占统治地位的桌面操作系统,也使得IE占据了通知地位,许多的网站开发的时候,就按照IE6的标准去开发,而IE6自身的标准也是微软公司内部定义的。到了IE7出来的时候,采用了微软公司内部标准以及部分W3C的标准,这个时候许多网站升级到IE7的时候,就比较痛苦,很多代码必须调整后,才能够正常的运行。而到了微软的IE8这个版本,基本上把微软内部自己定义的标准抛弃了,而全面的支持W3C的标准,由于基于对标准彻底的变化了,使得原先在早期IE8版本上能够访问的网站,在IE8中无法正常的访问,会出现一些排版错乱、文字重叠,显示不全等各种兼容性错误。


与任何早期浏览器版本相比,Internet Explorer 8 对行业标准提供了更加紧密的支持。 因此,针对旧版本的浏览器设计的站点可能不会按预期显示。 为了帮助减轻任何问题,Internet Explorer 8 引入了文档兼容性的概念,从而允许您指定站点所支持的 Internet Explorer 版本。 文档兼容性在 Internet Explorer 8 中添加了新的模式;这些模式将告诉浏览器如何解释和呈现网站。 如果您的站点在 Internet Explorer 8 中无法正确显示,则可以更新该站点以支持最新的 Web 标准(首选方式),也可以强制 Internet Explorer 8 按照在旧版本的浏览器中查看站点的方式来显示内容。 通过使用 meta 元素将 X-UA-Compatible 标头添加到网页中,可以实现这一点。


当 Internet Explorer 8 遇到未包含 X-UA-Compatible 标头的网页时,它将使用 指令来确定如何显示该网页。 如果该指令丢失或未指定基于标准的文档类型,则 Internet Explorer 8 将以 IE5 模式(Quirks 模式)显示该网页。更多



Title


网页头部信息


Link


css


icon


Style


在页面中写样式


例如:

 

.bb{ 

      background-color: red; 

   } 

 

Script


引进文件


写js代码

...




从代码中我们可以看到一个标准的html网页文件主要由2部分组成

这个标签之间的内容就是用来定义网页的标签栏的内容的

    

现在我们通过浏览器打开文件看到的就是标签页的有了标题

    


标签之间的内容就是用来定义页面的内容

    

再次刷新刚才的页面我们就看到了页面上已经有了文字

    

常用的标签


p和br标签

p是段落,两行字符之间是有间隔的

p和br都可以是实现字符串换行的效果,但是展示的时候还是有点细微的差别的。

    

刷新之后的结果如下

    


a标签

a标签用来定义一个跳转链接

    

实现的效果如下

    


另外标签还有一个功能就是定义锚点。也就是我们在网上阅读小说的时候,通过点击标签的链接直接调转到指定的章节。这个需要配置CSS的

标签定义一个指定id名称,然后调用a标签的href属性指定到
的id上就实现了锚点跳转


H标签

H标签是用来标识段落标题的加大加黑字体显示。并且H标签会占用一行

    

区别只是字体大小不一样

    


select标签 下拉菜单

运行结果

select还有另一种下拉菜单

运行结果


checkbox多选标签

运行结果


redio 单选框

注意如果单选框的name属性的值都是一样的,则同时只能选择一个选项。如果不指定name属性的值。就可以同时选取多个选项。效果如下:


文本输入框

当type='password'的时候,在框体内输入文字是隐藏的。通过在标签前面使用标签可在框体前面显示框体说明


button按钮

当type="submit"时候配合

标签可以实现表单提交功能。具体实现以后再说~


上传文件按钮

运行结果如下


多行文本输入框

通过CSS的style属性可以设置输入框的宽高尺寸



多级目录标签

运行结果


fieldset标签

运行结果


form表单

运行结果





备注

html语句中常用符号

大于号用 >


小于号用 <


字符之间的空格用  

例子如下

其他符号请参考:http://www.cnblogs.com/web-d/archive/2010/04/16/1713298.html


上面html介绍的各种代码如下

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <!--定义网页标签页的内容-->    <title>网页标签测试</title></head><body>默认的html语言是不支持通过回车换行的<p>带有P标签的第一行</p><p>带有P标签的第二行</p>通过br换行符<br>来分割两行文字<br><br><a href="https:\\www.baidu.com">在当前页面跳转到百度</a><a href="https:\\www.baidu.com" target="_blank">在新页面打开百度网页</a>H 标签<h1 id="H">H1</h1><h2 id="H">H2</h2><h3 id="H">H3</h3><h4 id="H">H4</h4><h5 id="H">H5</h5><h6 id="H">H6</h6>select 标签<br><select>    <option value="1">上海</option>    <option value="2">北京</option>    <option value="3" selected="selected">广州</option></select><select>    <optgroup label="河北省">        <option>石家庄</option>        <option>邯郸</option>    </optgroup>    <optgroup label="山西省">        <option>太原</option>        <option>平遥</option>    </optgroup></select><br><h2 id="Checkbox">Checkbox</h2><input type="checkbox"><input type="checkbox" checked=""><input type="checkbox" checked="checked"><br><h2 id="redio">redio</h2>男<input type="radio" value="man">女<input type="radio" value="male">保密<input type="radio" value="no"><br><br>男<input type="radio" name="gender" value="man">女<input type="radio" name="gender" value="male">保密<input type="radio" checked="checked" name="gender" value="no"><br><h2 id="password">password</h2><label>显示输入信息<input type="text"></label><br><br><label>隐藏输入信息<input type="password"></label><br><h2 id="button">button</h2><input type="button" value="普通按钮"><input type="submit" value="提交按钮"><br><h2 id="file">file</h2><input type="file" value="文件上传"><p>提交文件时: enctype='multipart/form-data' method='POST'</p><br><h2 id="textarea">textarea</h2><textarea></textarea><textarea style="width:500px;height: 200px;"></textarea><br><h2 id="ul-nbsp-ol-nbsp-dl">ul ol dl</h2><p>ul</p><ul>    <li>ul.li</li>    <li>ul.li</li>    <li>ul.li</li></ul><p>ol</p><ol>    <li>ol.li</li>    <li>ol.li</li>    <li>ol.li</li></ol><p>dl</p><dl>    <dt>河北省</dt>    <dd>邯郸</dd>    <dd>石家庄</dd>    <dt>山西省</dt>    <dd>太原</dd>    <dd>平遥</dd></dl><br><h2 id="fieldset">fieldset</h2><fieldset>    <legend>登录</legend>    <p>用户名:</p>    <p>密码:</p></fieldset><br><h2 id="form-nbsp-表单">form 表单</h2><form method="POST" action="http://www.baidu.com">    <input type="submit" value="post提交"></form><br><br><form method="GET" action="http://www.baidu.com/s">    <input type="text" name="wd">    <input type="submit" value="GET提交"></form><p>文件:enctype='multipart/form-data' method='POST'</p>大于号 ><br>小于号 <<br>字符之间的空格 a b</body></html>





















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
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.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

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

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)