三种css样式表及其优先级
生活随笔
收集整理的這篇文章主要介紹了
三种css样式表及其优先级
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.行內樣式
body內:
<p style="text-indent: 2em;color: red">
我是行內樣式
</p>
2.內部樣式表
body內:
<div class="inside">
我是內部樣式表我是內部樣式表
</div>
head內:
<style type="text/css">
.inside{
width: 300px;
height: 300px;
border: 1px solid blue;
}
</style>
3.外部樣式表
body:
<div class="outside">
我是外部樣式表
</div>
head內連接外部css樣式代碼:
<link rel="stylesheet" type="text/css" href="css/outside.css">
外部樣式代碼:
.outside{
width: 300px;
margin-bottom: 20px;
height: 200px;
background-color:#0f0;
}
優先級:行內樣式>內部樣式表>外部樣式表
?
轉載于:https://www.cnblogs.com/xiaoxiao2017/p/7878100.html
總結
以上是生活随笔為你收集整理的三种css样式表及其优先级的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SQL语句关键字执行顺序
- 下一篇: 2017年第10批 手机号正则表达式