web前端【补充】CSS补充
css常用的一些屬性:
1.去掉下劃線 :text-decoration:none ;
2.加上下劃線: text-decoration: underline;
3.調整文本和圖片的位置(也就是設置元素的垂直對齊方式):vertical-align:-20px;
沒設置之前:
?
設置之后:
3.外邊距:margin
4.內邊距:padding
5.居中;margin 0 auto;(只是針對盒子居中)
6內聯標簽是不可以設置長寬的,有時候就得把內聯標簽變成塊級標簽或者塊級內聯標簽,這就用到了display標簽。。
1.將內聯標簽轉換成塊級標簽:display:block;
2.將塊級標簽轉換成內聯標簽:display:inline;
3.塊級內聯標簽:display;inline-block;
塊級內聯標簽可以像塊級一樣可設長寬,也可像內聯一樣在一行顯示
6.隱藏的兩個方法:display:none; #隱藏了會頂上去
visibility :hidden; #隱藏了不會頂上去
7.隱藏溢出的兩個方法:overflow :auto;
overflow :scoll; ?#帶滾動條
8.文本水平居中:text-align:center;
? ?文本垂直居中:line-height;
9.偽類;
1.沒訪問之前: a:link{color:red;}?
2.鼠標懸浮時: a:hover{color:green;}
3.訪問過后: a:visited{color:yellow;}
4.鼠標點擊時 a:active{color:blue;}
5.在p標簽屬性為c2的后面加上內容
p.c2:after{
content:'hello';
color:red;
}
6.在p標簽屬性為c2的錢面加上內容
p.c2:before{
content:'啦啦啦';
color:red;
}
10.position的四種屬性
1.static:默認位置
2.fixed:完全脫離文檔流,固定定位(以可視窗口為參照物)
3.relative:相對定位(參照的是自己本身的位置),沒有脫離文檔流,沒有頂上去,會保持自己的位置不動。可以使用top left進行定位
4.absolute:絕對定位:脫離了文檔流(參照的是按已定位的父級標簽定位,如果找不到會按body的去找)
注意!!:將定位標簽設置為absolute,將他的父級標簽設置為定位標簽 (relative)
11.float和position的區別
float:半脫離文檔流
position:全脫離文檔流
12.z-index 屬性設置元素的堆疊順序。擁有更高堆疊順序的元素總是會處于堆疊順序較低的元素的前面。
13.透明度:opacity:0.4;
14.邊框弧度:border-radius: 50%;
15.去除列表前面的標志:list-style:none;
16.對齊上面和左邊最頂部:padding:0; margin:0;
17.字體加粗樣式: font-weight: 900;?
18.需要注意的幾個邏輯表達式的問題,下面的這個和js的&&,||用法是一樣的
print(3 and 5) #兩個為真才為真
print(0 and 3) #0是假就不判斷后面了,直接成假了
print(0 or 3) #有一個為真就為真
print(2 or 3) #2已經為真了那么就不會去判斷后面了
//后臺管理布局 <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>后臺管理布局</title><style>*{margin: 0;}a{text-decoration: none;}.header{width: 100%;height: 44px;background-color: #2459a2;}.title li{width: 100px;height: 80px;list-style: none;text-align: center;line-height: 80px;margin-top: 20px;padding: 50px;background-color: blue;}.leftmenu .title a{font-size: 18px;color: white;}.leftmenu{width: 300px;background-color: grey;position: fixed;top: 44px;left:0;bottom: 0;}.con{position: fixed;top: 44px;left: 300px;right:0;bottom: 0;background-color: darksalmon;overflow: scroll;}</style> </head> <body> <div class="header"></div> <div class="content"><div class="leftmenu"><ul class="title"><li><a href="">菜單一</a></li><li><a href="">菜單二</a></li><li><a href="">菜單三</a></li></ul></div><div class="con"><h1>hellp</h1><h1>hello</h1><h1>hello</h1></div> </div> </body> </html>
//遮蓋層 <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>遮罩層</title><style>.backgroup{width: 100%;height: 2000px;}.zzc{position: fixed;bottom: 0;top:0;left:0;right:0;background-color: grey;opacity: 0.4;}</style> </head> <body> <div class="backgroup"><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p><p>haiyan</p> </div> <div class="zzc"></div> </body> </html>
?
轉載于:https://www.cnblogs.com/xiaohema/p/8455449.html
總結
以上是生活随笔為你收集整理的web前端【补充】CSS补充的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 从宏杉合作伙伴大会看本土存储厂商的“逆袭
- 下一篇: 微信浏览器看控制台