Html与CSS快速入门01-基础概念_html/css_WEB-ITnose
Web前端技术一直是自己的薄弱环节,经常为了调节一个简单的样式花费大量的时间。最近趁着在做前端部分的开发,果断把这部分知识成体系的恶补一下。内容相对都比较简单,很类似工具手册的学习,但目标是熟练掌握。
Html(Hypertext Markup Language超文本标记语言):1990由Tim Berners-Lee爵士设计,成为了Internet上标准的文本传输形式,可以这么说,对于在互联网行业工作的我们来说,这就是我们饭碗的基础啊,嘿嘿。
基本文档格式,请见如下示例:
1 |
|
常见HTML标签
标签元素 | 诠释 |
.. | 封闭整个HTML文档 |
.. | 封闭HTML文档的头部,在标签内使用 |
指定文档的页面标题,在标签内使用 | |
.. | 封闭HTML文档的主体,在标签内使用 |
.. | 段落,在段落之间跳过一行 |
和 | 换行符和水平标号 |
.... | 1,2级标题 |
页面或区域的顶部 | |
页面或区域的脚注 | |
页面或者整个站点的导航链接 | |
内容的主题组 | |
一段独立的内容,比如新闻故事 | |
与包含它内容相关的辅助内容 |
Tip:验证Web内容,http://validator.w3.org/
平时,有空可以通过View Source来查看常见网站的源代码,看看有什么值得借鉴的地方。
CSS(Cascading Style Sheet):层叠样式表是一种定义样式构造的语言,比如字体、颜色和定位,它描述了如何在Web页面上格式化和现实信息。其包含的样式规则是一种格式化指令,可以应用于Web页面的元素,比如文本段落或链接。
基本的外部样式表,一个简单的示例如下所示:
1 |
|
基本布局属性(display属性)
标签元素 | 诠释 |
block | 在新行上显示元素,比如在一个新段落中 |
List-item | 在新行上显示元素,并在其旁边带有一个列表项标记 |
inline | 利用当前段落内联显示元素 |
none | 不显示元素,它是隐藏的 |
Diplay属性依赖于相对定位(relative positioning)的概念,它以为着元素将相对于页面上的其他元素进行定位,之后还会介绍绝对定位(absolute positioning)的概念。
Tip:常见的表示长度和宽度的单位有:in,英寸;cm厘米,mm毫米,%百分比,px像素,pt磅。
基本格式化属性
属性 | 诠释 |
Border | 边框的各边 |
Border-Width | 边框边缘的宽度 |
Border-color | 边框边缘颜色 |
Border-style | 边框边缘样式:solid单线边框,double双线边框,dashed短划虚线边框,dotted点线边框,groove具有沟槽外观的边框,none无边框,hidden等价无边框 |
Border-left/right/top/bottom | 边框左、右、上、下 |
Background-color | 元素的内部区域颜色 |
Text-align | 内容对齐方式,包括左边、右边、中间,justify两端对齐 |
Text-indent | 内容缩进方式 |
Font-family | 字体系列,按顺序选择 |
Font-size/weight | 字体大小和粗细(normal,lighter,bold,bolder) |
Font-style | 字体的样式,normal,italic |
Line-height | 行距,用于设置每个文本行的高度 |
Padding | 给元素左边、右边、上边、下边添加填充 |
使用样式类和ID
1 |
|
Tip:验证样式表,http://jigsaw.w3.org/css-validator/
经典的html5页面结构如下图所示
参考资料:
-
梅洛尼 . HTML与CSS入门经典(第9版) [M]. 北京:人民邮电出版社, 2014.

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

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

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.
