
批改狀態(tài):合格
老師批語(yǔ):
答案;通過(guò)box- sizing屬性來(lái)指定內(nèi)容區(qū)的邊界在哪里
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>偽類選擇器的參數(shù)</title>
</head>
<body>
<ul class="list">
<li>item1</li>
<li>item2</li>
<li>item3</li>
<li>item4</li>
<li>item5</li>
<li>item6</li>
<li>item7</li>
<li>item8</li>
</ul>
<style>
/*:nth-0f-type(參數(shù))*/
/*大參數(shù)=an+ba,n,b=[0,1,2,3,4,..]*/
/*a:系數(shù), n:計(jì)算器乘, b:偏移量*/
/*元素的有效編號(hào): 必須從1開始,n是從0開始,b也是從0開始*/
/* nth-of-type(3) h-of-type(on+3)*/
.list > :nth-of-type(0n + 3) {
/* background-color: darkkhaki; */
}
/* 1n+b: */
.list > :nth-of-type(1n + 3) {
/* background-color: red; */
}
/*k10+3=3*/
/*1*1+3=4*/
/*1*2+3=5*/
/*大因?yàn)?乘任何數(shù)都不變,所以1可以不寫*/
.list > :nth-of-type(n + 3) {
/* background-color: rebeccapurple;*/
}
/*匹配所有的偶數(shù)元素*/
/*.list > :nth-of-type(2n) {
background-color: rebeccapurple;
}*/
/* even表示偶數(shù)
.list > :nth-of-type(even) {
background-color: rebeccapurple;
}*/
/* 2 * 1 = 2 2*2 = 4 */
/*奇數(shù)
.list > :nth-of-type(2n + 1) {
background-color: rebeccapurple;
}*/
/*.list > :nth-of-type(odd) {
background-color: rebeccapurple;
}*/
/*前三個(gè)*/
.list > :nth-of-type(-n + 3) {
background-color: rebeccapurple;
}
/*-1*0+3=3
1*1+3=2
1*2+3=1
1*3+3=0(非法索引,匹配就結(jié)束了)*/
/*后三個(gè)*/
.list > :nth-last-of-type(-n + 3) {
background-color: rebeccapurple;
}
/*大總結(jié)一下
1.獲取指定的某一個(gè):(
2,獲取前幾個(gè),(n-b)
3.獲取指定位置后的全部元素,(n+b)
4.獲取全部偶數(shù)(2n/even)或奇數(shù)(2n+1/0dd)元素*/
html {
background-color: royalblue;
}
/*:root = html */
:root {
background-color: saddlebrown;
}
</style>
<input type="text" />
<input type="text" disabled />
<style>
input:disabled {
background-color: red;
}
input:enabled {
background-color: royalblue;
}
</style>
</body>
</html>
/* 我只要?jiǎng)討B(tài)的改變r(jià)em的大小,就可以動(dòng)態(tài)的調(diào)整每個(gè)按鈕的大小 */
/* 移動(dòng)優(yōu)先,從最小的屏幕開始進(jìn)行媒體查詢 */
/* @media (min-width:480px) {
html {
font-size: 12px;
}
}
@media (min-width:640px) {
html {
font-size: 14px;
}
}
@media (min-width:720px) {
html {
font-size: 16px;
}
}*/
/* 桌面優(yōu)先/pc優(yōu)先 由大屏到小屏幕 */
@media (max-width:720px) {
html {
font-size: 16px;
}
}
@media (min-width:640px) {
html {
font-size: 14px;
}
}
@media (min-width:480px) {
html {
font-size: 12px;
}
}
@media (min-width:720px) {
html {
font-size: 16px;
}
}
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)