日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

web前端【补充】CSS补充

發布時間:2023/12/10 HTML 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 屬性設置元素的堆疊順序。擁有更高堆疊順序的元素總是會處于堆疊順序較低的元素的前面。

//測試z-index <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>Title</title><style>.img1 {position:absolute;left:0;top:0;z-index:-10;}.img2 {position:absolute;left:0;top:0;z-index:-3; //越大越往前排,離你越近}.img3 {position:absolute;left:0;top:0;z-index:-5;}</style> </head> <body> <div class="img3"><img src="作業/1.jpg" alt=""></div> <div class="img2"><img src="作業/2.jpg" alt=""></div> <div class="img1"><img src="作業/3.jpg" alt=""></div> </body> </html>

  

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</title><style>*{padding:0;margin: 0;}.outer{width:790px;height: 340px;border: solid 1px red;margin: 0 auto;margin-top: 40px;position: relative;}ul{list-style: none;position: absolute;top: 0;left:0;}.com{position: absolute;display: none;/*visibility: hidden;*/}.num{position: absolute;top: 300px;left: 330px;}.num li{display: inline-block;width: 20px;height: 20px;color: black;background-color: white;border-radius: 50%; //邊框弧度line-height: 20px;text-align: center;}.btn{position: absolute;width: 40px;height: 60px;background-color: grey;opacity: 0.5; //透明度color: black;font-weight: 900; //加粗text-align: center;line-height: 60px;top:50%;margin-top: -30px;}.leftbtn{left:0;}.rightbtn{right:0;}</style> </head> <body> <div class="outer"><ul class="img"><li><a href=""><img src="1.jpg" alt=""></a></li><li class="com"><a href=""><img src="2.jpg" alt=""></a></li><li class="com"><a href=""><img src="3.jpg" alt=""></a></li><li class="com"><a href=""><img src="4.jpg" alt=""></a></li><li class="com"><a href=""><img src="5.jpg" alt=""></a></li><li class="com"><a href=""><img src="6.jpg" alt=""></a></li></ul><ul class="num"><li></li><li></li><li></li><li></li><li></li></ul><div class="leftbtn btn"> < </div><div class="rightbtn btn"> > </div></div></body> </html>

  

//后臺管理布局 <!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补充的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。