CSS選擇器

所有HTML語言中的標記都是通過不同的CSS選擇器進行控制的。用戶只需要通過選擇器對不同的HTML標籤進行控制,並賦予各種樣式聲明,即可實現各種效果。

標記選擇器

<style>
h1{
    color:red;
    font-size:25px;
}
</style>

類別選擇器

<head>
.css{
    color:blue;
    font-size:25px;
    }
</head>
<body>
<p class = "css">
zyy
</p>
</body>

ID選擇器

<style type = "text/css">
	#my_p{
		color:green;
		font-size:25px;
	}
</style>
</head>
<body>
	<p id = "my_p">
		學習java
	</p>
</body>

屬性選擇器

<style type = "text/css">
	input[type = "text"]{
		color: red;
		font-size = 39px;
	}
</style>
</head>
<body>
	姓名:<input type = "text" name = "name"/>
</body>


發佈了26 篇原創文章 · 獲贊 0 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章