◆要素+要素
直後に隣接している要素にCSSをかける
h1 + p ・・・h1の直後のpタグ
◆:nth-child(n) 子要素はすべてカウントされる
◆:nth-of-type(n) 指定した要素のみカウントする
◆:nth-child(5) 5番目の要素
※「an+b」という式は、aとbの部分を整数に置き換えて使用します。(0でも負の値でもOKです。nはそのまま使用するが、これは0以上の整数を表し、0,
1,2・・・・と変化したときの計算結果の個数目の要素が適用される。
◆:nth-child(odd)⇔:nth-child(2n+1)奇数番目の要素
◆:nth-child(even)⇔nth(2n)偶数番目の要素
◆:nth-child(3n)3、6、9、12、・・・番目の要素
◆:nth-child(3n+1)1、4、7、10・・・番目の要素
◆::first-line 最初の行に対してCSSをかける
◆::first-letter 最初の文字に対してCSSをかける
◆:empty 空要素に対してCSSをかける
◆:nth-of-type(n) 指定した要素のみカウントする
◆:nth-child(5) 5番目の要素
※「an+b」という式は、aとbの部分を整数に置き換えて使用します。(0でも負の値でもOKです。nはそのまま使用するが、これは0以上の整数を表し、0,
1,2・・・・と変化したときの計算結果の個数目の要素が適用される。
◆:nth-child(odd)⇔:nth-child(2n+1)奇数番目の要素
◆:nth-child(even)⇔nth(2n)偶数番目の要素
◆:nth-child(3n)3、6、9、12、・・・番目の要素
◆:nth-child(3n+1)1、4、7、10・・・番目の要素
◆::first-line 最初の行に対してCSSをかける
◆::first-letter 最初の文字に対してCSSをかける
◆:empty 空要素に対してCSSをかける
<!DOCTYPE html>
<html lang=ja>
<head>
<meta charset="utf-8">
<title>template</title>
</head>
<body>
<script>
var name = "suzuki";
if(name === "suzuki"){console.log('私です。');}
else{console.log('私じゃない');}
</script>
</body>
</html>
<html lang=ja>
<head>
<meta charset="utf-8">
<title>template</title>
</head>
<body>
<script>
var name = "suzuki";
if(name === "suzuki"){console.log('私です。');}
else{console.log('私じゃない');}
</script>
</body>
</html>
