Home Web Front-end HTML Tutorial HTML study notes (CSS) NO.3_html/css_WEB-ITnose

HTML study notes (CSS) NO.3_html/css_WEB-ITnose

Jun 24, 2016 am 11:49 AM

1

css指层叠样式表css样式表极大地提高了工作效率属性选择器selector{ property:value;}如h1{    color:red;  front-size:14px;}选择器分组如h1,h2,h3{    color:red;}将h1,h2,h3的标签属性设置成相同的属性继承:如body{  color:red;  }派生选择器:通过依据元素在其位置的上下文关系来定义样式id选择器:可以为有id的HTML元素指定特定的样式,以#来定义目前比较常用的方式是id选择器常常用于建立派生选择器如#在html中通过id属性来定义的标签{ 属性:值;}#在html中通过id属性来定义的标签  内部嵌套的子标签名称{ 属性: 值;}类选择器:类选择器以一个点显示class也可以作为派生选择器如首先在表现中以class关键字指定其class名称然后在CSS中使用如下方式:.指定的class名称{   性质:值;}属性选择器:对带有指定属性的HTML元素设置样式属性选择器,属性和值选择器在IE6一下版本是不支持的方式:<style type="text/css">        [title]{            color:blue;        }        [title=te]{            color:red;        }    </style>然后在指定的标签内指定title属性值即可改变颜色CSS样式->字体、连接、列表、表格、轮廓CSS背景:CSS允许应用纯色作为背景,也允许使用背景图像创建相当复杂的效果background-attachment      背景图像是否固定或者随着页面的其余部分滚动background-color       设置元素的背景颜色background-image       把图片设置为背景background-position     设置背景图片的起始位置background-repeat        设置背景图片是否及如何重复background-size            规定背景图片的尺寸background-origin      规定背景图片的定位区域background-clip          规定背景的绘制区域CSS文本:CSS文本属性可以定义文本外观通过文本属性,可以改变文本的颜色、字符间距、对齐文本、装饰文本、对文本缩进*表示比较常用的color        文本颜色*direction  文本方向line-height 行高letter-spacing    字符间距text-align  对齐元素中的文本*text-decoration    想文本添加修饰text-indent  缩进元素中文本的首行*text-transform   元素中的字母*unicode-bidi 设置文本方向white-space   元素中空白的处理方式word-spacing  字间距text-shadow  向文本添加阴影word-wrap    规定文本的换行规则CSS的字体:css可以定义文本的字体系列、大小、加粗、风格和变形font-family   设置字体系列font-size 设置字体的尺寸font-style   设置字体风格font-variant  以小型大写字体或正常字体显示文本font-weight 设置字体的粗细CSS的连接:四种状态a:link        普通的、未被访问的连接a:visited    用户已访问的连接a:hover     鼠标指针位于连接的上方a:active 正在被点击常见的连接样式:text-decoration属性大多用于去掉连接中的下划线CSS列表:CSS列表允许防止、改变列表标志,或者将图像作为列表标志list-style     简写列表项list-style-image   列表项图像list-style-position    列表标志位置list-style-type       列表类型一般以ID方式进行标记的话用在框架级别上,而class方式用在具体内容细节方面,一些数据的构造等方式CSS的表格:表格属性可以帮助我们极大的改善表格的外观boder-collapse     折叠边框(即只有一条线)border          边框显示CSS的轮廓:主要是用来突出元素的作用outline          设置轮廓属性outline-color     设置轮廓颜色outline-style     设置轮廓的样式outline-width        设置轮廓的宽度CSS盒子模型:盒子模型包括margin(外边距)、border(边框)、padding(内边距)、content(包含宽和高width、height)部分内边距属性(内边距在content外,边框内)padding         设置所有的边距padding-bottom       设置底边距padding-left       设置左边距padding-right      设置右边距padding-top        设置上边距CSS边框:可以创建出效果出色的边框,并且可以应用于任何元素边框样式:通过关键字border-style关键字可以定义10中不同非继承样式(包括none)可以进行单边框样式的更改:上下左右四个方向border-top-styleborder-bottom-styleborder-left-styleborder-right-style边框的宽度:border-widthborder-上下左右-width边框颜色border-colorborder-上下左右-colorCSS3边框:border-radius       :圆角边框box-shadow     :边框阴影border-image       :边框图片对于阴影效果有四个参数:1、向右移动几个像素2、向下移动几个像素3、阴影的透明度4、颜色外边距margin:marginmargin-上下左右外边距具有叠加的性质,如果两个样式的东西挨着设计margin则margin选择最大值得那个样式的margin值CSS定位:改变元素在页面上的位置定位机制:普通流->元素按照在其HTML中的位置顺序决定排布的过程浮动绝对布局CSS的定位属性:position     把元素放在一个静态的、相对的、绝对的活固定的位置中top            元素向上偏移量bottom           元素向下偏移量right            元素向右偏移量left         元素向左偏移量overflow     设置元素一处其区域发生的事情clip          设置元素显示的形状vertical-align     设置元素垂直对齐方式z-index           设置元素的堆叠顺序position属性:static/relative/absolute/fixedabsolute效果是不再占用页面的位置static时任何偏移量的关键字对齐都不产生影响fixed当内容可以进行滚动时,fixed的内容不会滚动CSS的浮动:float属性->left       元素向左浮动right     元素向右浮动none      元素不浮动inherit        从父级继承浮动属性clear属性:去掉浮动属性(包括继承来的属性)clear属性值:left/right:去掉元素向左向右的浮动both:左右两侧均去掉浮动inherit:从父级继承来的clear的值

Copy after login
Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Mar 04, 2025 pm 12:32 PM

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

How to efficiently add stroke effects to PNG images on web pages? How to efficiently add stroke effects to PNG images on web pages? Mar 04, 2025 pm 02:39 PM

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

How do I use the HTML5 <time> element to represent dates and times semantically? How do I use the HTML5 <time> element to represent dates and times semantically? Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 &lt;time&gt; element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

See all articles