Blogger Information
Blog 10
fans 0
comment 1
visits 3174
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演示html元素的样式来源与优先级(有图示)
P粉753609736
Original
353 people have browsed it

元素的样式与优先级

一.行内样式>文档样式>外部样式>默认样式。

行类样式的三大通用属性是id,class,style

1.默认样式继承标签默认样式

  1. h1 {
  2. display: block;
  3. font-size: 2em;
  4. margin-block-start: 0.67em;
  5. margin-block-end: 0.67em;
  6. margin-inline-start: 0px;
  7. margin-inline-end: 0px;
  8. font-weight: bold;
  9. }

2.外部样式引用css样式

  1. h1 {
  2. color: rgb(41, 191, 96);
  3. }

3.文档样式在html文档里面style标签修改自定义样式的元素。

  1. h1 {
  2. color: red;
  3. font-weight: normal;
  4. }

4.行类样式

  1. <h1 style="color: red">hello world</h1>

5.上效果图

![效果图](https://github.com/yydoos/22/blob/main/0117/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%202023-01-18%20151941.png?raw=true)

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:一个作业写一篇文章就可以了
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post