先说明一下,我也是半路出家的和尚,可能有些地方说的不到位,只是个人观点而已。
记得我学这块内容的时候是在北京一家公司上班的时候学的,那时候也没有人带着学习,就别人说了W3C,然后就开始自己看,照着里面的内容去打代码,每天晚上都敲到陵城3点,然后理解各个标签的作用(可能说的不标准),然后一个一个的看标签的属性。自己最开始独立写的一个页面就是用table写了一张简历。
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>个人简历</title></head><body bgcolor="#BBFFFF"> <center><h2 id="个人简历">个人简历</h2></center> <table cellpadding="0" cellspacing="0" border="1px" width="800px" height="600px" align="center"> <tr align="center" height="50px"> <td>姓名</td><td>Strip_liu</td><td rowspan="4">照片区</td> </tr> <tr align="center" height="50px"> <td>性别</td><td>男</td> </tr> <tr align="center" height="50px"> <td>电话</td><td>180xxxxxxxx</td> </tr> <tr align="center" height="50px"> <td>E-mail</td><td>strip_liu@xxx.com</td> </tr> <tr > <td align="center">工作经验</td><td colspan="2">上大学的时候……</td> </tr> <tr> <td align="center">个人介绍</td><td colspan="2">我叫XXX,……</td> </tr> <tr> <td align="center">兴趣爱好</td><td colspan="2">我喜欢象棋……</td> </tr> </table> <center><a href="这里当时写的是QQ空间地址">我的空间</a></center></body></html>
效果图:
这段代码严格来说,还是有问题的,因为当时虽然已经知道div这个东西,但是根本不知道怎么用,一想到做一个简历,第一想到的就是table表格,因为这个本来就是表的形式,只要自己稍稍合并一下单元格就OK了。
这里说一下代码吧。在写出来之后我才知道center这个标签已经被丢弃了;
这里在body里面直接加了北京颜色,也就是bgcolor属性,table中的cellpadding -- 代表单元格外面的一个距离,用于隔开单元格与单元格空间,这里一般都设置为0,cellspacing单元格间距表格间距 -- 代表表格边框与单元格补白的距离,也是单元格补白之间的距离,一般也设置为0;
border属性一般块元素都有,不过有的设置显示有的设置为不显示,border一般用法是 border:宽度 实线/虚线 颜色;width和height是设置整张表宽度和高度的;当然,在任何块元素(标签)中,width和height都是设置宽高的。
tr是行元素,也就是一对tr标签就是一行,tr元素对应的就是td,td代表列,一般内容填充就填充在列种,rowspan是表示跨行合并,后面的数字就代表着跨几行合并单元格,同理colspan是跨列合并,后面数字代表的跨几列;
从上面代码中我们可以看到,text-align="center"这个属性,这是设置行内居中的,但是我有的写在tr中 有的写在td中,虽然这种写法很烂,但初学者这样写很正常,也更加容易理解这个属性带来的效果,因为我有些是要正行居中,所以写在tr中,而有些只需要一个列居中,就单独的写了列居中。
最后是a标签,a标签就是一个超级链接,href属性就是它要链接到那个页面(注意的是href中一定要加上http://,也就是链接用的是http协议);
其实代码挺简单的,初学者可以看看。这些基本就是table的一些东西,真正写页面,现在用table显然已经很不现实了,但这也是基础。零零散散的说了一些,希望对初学者有用。

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for

HTMLtagsareessentialforstructuringwebpages,enhancingaccessibility,SEO,andperformance.1)Theyareenclosedinanglebracketsandusedinpairstocreateahierarchicalstructure.2)SemantictagslikeandimproveuserexperienceandSEO.3)Creativetagslikeenabledynamicgraphics

Self-closingtagsinHTMLandXMLaretagsthatclosethemselveswithoutneedingaseparateclosingtag,simplifyingmarkupstructureandenhancingcodingefficiency.1)TheyareessentialinXMLforelementswithoutcontent,ensuringwell-formeddocuments.2)InHTML5,usageisflexiblebutr

To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

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.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

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.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
