一、CSS設置樣式
1.1 邊框border
作用:設置標簽周圍的邊框,方法 board:寬度 樣式 顏色,一般情況下樣式使用 solid實體的,和dotted虛線的

<head> <meta charset="UTF-8"> <title>css邊框</title> <style> .c1{ border: 1px solid red; } </style> </head> <body> <div class="c1"> 今天天氣真好 </div> </body>
此外還有 border-top,border-left,border-right,border-bottom,分別是邊框頂部,邊框左邊,邊框右邊,邊框底部
1.2 高度height
作用:設置標簽的高度的,使用方法:height: 高度大小 ,可以是具體的數字大小比如說:20px,也可以是百分比:80%,但是高度沒有固定的值,這個設定要在一個邊框內,否則沒有意義。

<head> <meta charset="UTF-8"> <title>css邊框</title> <style> .c1{ border: 1px solid red; height: 80px; } </style> </head> <body> <div class="c1"> 今天天氣真好 </div> </body>
1.3 寬度width
作用:設置標簽的寬度,使用方法:width:寬度大小,這個跟上面的height是一樣的,可以是具體大小:50px,也可以根據瀏覽器大小設置為百分比:80%

<style> .c1{ border: 1px solid red; height: 80px; width: 70%; } </style>
1.4 字體大小 font-size
作用:設置標簽內的字體大小,使用方法:font-size:字體大小,示例:font-size:20px

<style> .c1{ border: 1px solid red; height: 80px; width: 70%; font-size:20px; } </style>
1.5 字體顏色 color
作用:設置標簽內的字體顏色, 使用方法: color:顏色,示例:color:red

<style> .c1{ border: 1px solid red; height: 80px; width: 70%; font-size:20px; color: blue; } </style>
1.6 字體加粗 font-weight
作用:給你標簽內的字體加粗。使用方式:font-weight:bold

<style> .c1{ border: 1px solid red; height: 80px; width: 70%; font-size:20px; color: blue; font-weight: bold; } </style>
1.7 水平居中
作用:能把標簽內的字體,進行水平居中。使用方法:text-align:center

<style> .c1{ border: 1px solid red; height: 80px; width: 70%; font-size:20px; color: blue; font-weight: bold; text-align: center; } </style>
1.8 垂直居中
作用:能把標簽內的字體,進行水平居中。使用方法:line-height:標簽高度值。

<style> .c1{ border: 1px solid red; height: 80px; width: 70%; font-size:20px; color: blue; font-weight: bold; text-align: center; line-height:80px; } </style>