重生唯舞独尊txt,今日金价多少一克,日暮途穷
外层元素身上的样式会被内层元素所继承,这句话的实践。
代码块
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>继承性</title> <style> body{ color: red; } </style> </head> <body> <div> <h2>微笑是最初的信仰</h2> <p>微笑是最初的信仰</p> </div> </body> </html>
结果图
当内层元素身上的样式与外层的元素身上的样式相同时内层元素样式会覆盖外层元素样式,这句话的实践。
代码块
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>继承性</title> <style> body{ color: red; font-size: 18px; } div{ color: springgreen; } </style> </head> <body> <div> <h2>微笑是最初的信仰</h2> <p>微笑是最初的信仰</p> </div> </body> </html>
结果图
并不是所有的样式都能够继承,只有文本与字体样式属性才能够被继承,其余的样式属性不可以被继承,这句话的实践。
代码块
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>继承性</title> <style> body{ color: red; font-size: 18px; } div{ color: springgreen; border: 1px solid red; } </style> </head> <body> <div> <h2>微笑是最初的信仰</h2> <p>微笑是最初的信仰</p> </div> </body> </html>
结果图
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
css3 flex布局 justify-content:space-between 最后一行左对齐
网友评论