標籤:單位 span block isp doc splay 空間 css 隱藏
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> div { height: 100px; width: 1000px; background-color: red; } </style></head><body> <!--行內標籤--> <span>好好學習</span> <strong>天天向上</strong> <s>勵精圖治</s> <!--塊級標籤--> <!--ul,ol,dl都是塊級標籤--> <div> 勤奮好學 </div></body></html>
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> div { height: 100px; width: 1000px; background-color: red; /*使得div塊變成行內元素*/ display:inline-block; } </style></head><body> <!--行內標籤--> <span>好好學習</span> <strong>天天向上</strong> <s>勵精圖治</s> <!--塊級標籤--> <!--ul,ol,dl都是塊級標籤--> <div> 勤奮好學 </div></body></html>
display:inline;
display:block;
display:none;
行內元素不能設定寬和高
visibility:hidden;隱藏但是佔用頁面空間
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> div { height: 100px; width: 1000px; background-color: red; display:block; visibility: hidden; } </style></head><body> <!--行內標籤--> <span>好好學習</span> <strong>天天向上</strong> <s>勵精圖治</s> <!--塊級標籤--> <!--ul,ol,dl都是塊級標籤--> <div> 勤奮好學 </div></body></html>
CSS單位與文字排版 display