CSS

CSSについて学習中。

CSSの基礎知識

CSSとは?ボックスの考え方・CSSの書き方、セレクタ・スタイル・プロパティ・値・スタイル項目・@ルール
短縮形の書き方
・input[type=”text”]{}
属性セレクタと呼ばれるもの。inputのどのタイプのやつにCSSをつけるかを決める
複数指定はinput[type=”text”],textarea{},で区切って[]の外に書く
・vhという単位は画面の〇%という意味

その他

画面の左右にどうしても出来る謎の白い余白を消す方法

CSSのプロパティについて

×→対応していない、〇→対応している 各々→個々のプロパティに応じて変化

align-content ×××auto
align-items ×××auto
align-self×××auto
alignment-baseline ×××baseline
all ×××各々
animation ×××各々
animation-delay ×××0
animation-direction ×××normal
animation-duration ×××0
animation-fill-mode ×××none
animation-iteration-count ×××1
animation-name ×××none
animation-play-state ×××running
animation-timing-function ×××ease
appearance ×××auto
azimuth ××center
backface-visibility ×××visible
background 各々
background-attachment scroll
background-blend-mode ×××normal
background-clip ×××border-box
background-color
背景色を指定する
#RRGGBB/#RGB
色名
rgb()/rgba()
hsl()/hsla()
transparent(透明)
transparent
background-image
背景画像を指定する
url(⋯)(画像のURL)
複数の背景画像を指定する
{background-image: 1つ目の背景画像の値, 2つ目の背景画像の値, ⋯}

none
repeat(並べて表示)
repeat-x(横方向のみに並べて表示)
repeat-y(縦方向のみに並べて表示)
no-repeat(繰り返しなし)
none
background-origin ×××padding-box
background-position 0% 0%
background-repeat
背景画像の繰り返しを指定する
repeat
background-size covor(ボックス全体を塗りつぶしたいとき)
contain(画像全体を表示させたいとき)
×××auto
baseline-shift ×××0
binding ×××none
bleed ×××6pt
bookmark-label ×××content()
bookmark-level ×××none
bookmark-state ×××open
border
すべてのボーダーに関する属性をまとめて指定する
各々
border-bottom
下ボーダーに関する属性をまとめて指定する
solid(1本の線)各々
border-bottom-color
下ボーダーの色を指定する
×currentColor
border-bottom-left-radius ×××0
border-bottom-right-radius ×××0
border-bottom-style
下ボーダーのスタイルを指定する
×none
border-bottom-width
下ボーダーの太さを指定する
medium
border-boundary ×××none
border-collapse
テーブル(表)のボーダーの表示モデルを指定する
collapse(線が一本になる・隣接するセルのボーダーを重ねて表示)
separate(隣接するセルのボーダーを間隔をあけて表示)
×separate
border-color
ボーダーの色をまとめて指定する
#RRGGBB/#RGB
色名
rgb()/rgba()
hsl()/hsla()
transparent(透明)
各々
border-image ×××none
border-image-outset ×××0
border-image-repeat ×××stretch
border-image-slice ×××100%
border-image-source ×××none
border-image-width ×××1
border-left
左ボーダーに関する属性をまとめて指定する
depending on individual properties
border-left-color
左ボーダーの色を指定する
×currentColor
border-left-style
左ボーダーのスタイルを指定する
×none
border-left-width
左ボーダーの太さを指定する
medium
border-radius ×××0
border-right
右ボーダーに関する属性をまとめて指定する
depending on individual properties
border-right-color
右のボーダーの色を指定する
×currentColor
border-right-style
右ボーダーのスタイルを指定する
×none
border-right-width
右ボーダーの太さを指定する
medium
border-spacing
ボーダーとセル内容との間隔を指定
数値+単位×0px 0px
border-style solid(実線)
double(二重線)
groove(溝線)
ridge(稜線)
inset(沈みこみ)
outset(浮き出し)
none(ボーダーなし)
hidden(ボーダーを表示しない)
dashed(破線)
dotted(点線)
depending on individual properties
border-top
上ボーダーに関する属性をまとめて指定する
depending on individual properties
border-top-color
上ボーダーの色を指定する
×currentColor
border-top-left-radius ×××0
border-top-right-radius ×××0
border-top-style
上ボーダーのスタイルを指定する
×none
border-top-width
上ボーダーの太さを指定する
medium
border-width
ボーダーの太さをまとめて指定する
数値+単位
thin(細線)
medium(通常の太さの線)
thick(太線)
depending on individual properties
bottom
下からの位置を指定
数値+単位
数値+%
auto
×auto
box-decoration-break ×××slice
box-shadow ×××none
box-sizing ×××content-box
box-snap ×××none
box-suppress ×××show
break-after ×××auto
break-before ×××auto
break-inside ×××auto
caption-side ×top
caret ×××auto
caret-color ×××auto
caret-shape ×××auto
chains ×××none
clear
ボックスのフロートを解除
left(左寄せのフロートを解除)
right(右寄せのフロートを解除)
both(両方解除)
none(解除しない)
none
clip ××auto
clip-path ×××none
clip-rule ×××nonzero
color
文字色を指定する
#RRGGBB/#RGB
色名
rgb()/rgba()
hsl()/hsla()
transparent(透明)
implementation-dependent
color-adjust ×××economy
color-interpolation-filters ×××auto
column-count ×××auto
column-fill ×××balance
column-gap ×××normal
column-rule ×××depending on individual properties
column-rule-color ×××implementation-dependent
column-rule-style ×××medium
column-rule-width ×××medium
column-span ×××none
column-width ×××auto
columns ×××depending on individual properties
contain ×××none
content ×normal
counter-increment ×none
counter-reset ×none
counter-set ×××none
crop ×××auto
cue ×depending on individual properties
cue-after ×none
cue-before ×none
cursor ×auto
direction ×ltr
display
ボックスの表示形式を変更
flex(メニューなどを横並びにする、フレックスボックス)
grid(ボックスを分割して並べる、グリッドレイアウト)
・block(ブロックレベル形式にする)
・inline(インライン形式にする)
inline-block(インラインブロックレベル形式にする)
・none(存在しないものとして処理される)
inline
display-inside ×××auto
display-list ×××none
display-outside ×××inline-level
dominant-baseline ×××normal
elevation ××level
empty-cells ×show
filter ×××none
flex ×××各々
flex-basis ×××auto
flex-direction ×××row
flex-flow ×××各々
flex-grow ×××0
flex-shrink ×××1
flex-wrap wrap(入りきれないときに改行:レスポンシブデザイン)×××nowrap
float
ボックスをフロートさせ、寄せて配置する(後続するボックスは回り込む)
今はほぼdisplay:flex
を使用
left(左寄せ)
right(右寄せ)
none(なし)
none
float-offset ×××0 0
flood-color ×××black
flood-opacity ×××1
flow-from ×××none
flow-into ×××none
font
フォントに関する属性をまとめて指定
各々
font-family
フォントの種類を指定する
Adobe・Googleフォントの導入
フォントの正式名称
総称(serif、sans-serif、cursive、fantasy、monospaceなど)
実装依存
font-feature-settings ×××normal
font-kerning ×××auto
font-language-override ×××normal
font-max-size ×××infinity
font-min-size ×××0px
font-optical-sizing ×××auto
font-palette ×××normal
font-presentation ×××auto
font-size
フォントサイズ(文字のサイズ)を指定
数値+単位
数値+%
xx-small
x-small
small
medium
large
x-large
xx-large
larger
smaller
medium
font-size-adjust ××none
font-stretch ××normal
font-style
フォントのスタイルを指定する
normal
italic
oblique
normal
font-synthesis ×××weight style
font-variant normal
font-variant-alternates ×××normal
font-variant-caps ×××normal
font-variant-east-asian ×××normal
font-variant-ligatures ×××normal
font-variant-numeric ×××normal
font-variant-position ×××normal
font-variation-settings ×××normal
font-weight
フォントの太さを指定する
normal
bold
bolder
lighter
normal
gap ×××各々
grid ×××各々
grid-area ×××各々
grid-auto-columns ×××auto
grid-auto-flow ×××none
grid-auto-rows ×××auto
grid-column ×××各々
grid-column-end ×××auto
grid-column-start ×××auto
grid-row ×××各々
grid-row-end ×××auto
grid-row-start ×××auto
grid-template ×××各々
grid-template-areas ×××none
grid-template-columns ×××none
grid-template-rows ×××none
hanging-punctuation ×××none
height
ボックスの高さを指定
数値+単位
数値+%
auto
auto
hyphens ×××manual
icon ×××auto
image-orientation ×××0deg
image-rendering ×××auto
image-resolution ×××1dppx
ime-mode ×××auto
initial-letters ×××normal
initial-letters-align ×××alphabetic
initial-letters-wrap ×××none
inline-sizing ×××normal
isolation ×××auto
justify-content ×××auto
justify-items ×××auto
justify-self ×××auto
left
左からの位置を指定
数値+単位
数値+%
auto
×auto
letter-spacing normal
lighting-color ×××white
line-break ×××auto
line-grid ×××match-parent
line-height
行の高さを指定する
数値(整数)
数値+単位
数値+%
normal
normal
line-snap ×××none
list-style
リストのマーカーに関する属性をまとめて指定する
各々
list-style-image
リストのマーカーに画像を指定する
url()(画像のURL)
none(なし)
none
list-style-position
リストのマーカーの位置を指定する
inside(内側)
outside(外側)
outside
list-style-type
リストのマーカーの種類を指定する
disc(黒丸)
circle(白丸)
square(四角)
decimal(10進数)
none(なし)
disc
margin
マージンの幅をまとめて指定する
数値+単位
数値+%
auto
各々
margin-bottom
下マージンの幅を指定する
0
margin-left
左マージンの幅を指定する
0
margin-right
右マージンの幅を指定する
0
margin-top
上マージンの幅を指定する
0
marker-offset ×××auto
marker-side ×××list-item
marks ××none
mask ×××border-box
mask-box ×××各々
mask-box-outset ×××0
mask-box-repeat ×××stretch
mask-box-slice ×××0 fill
mask-box-source ×××none
mask-box-width ×××auto
mask-clip ×××border-box
mask-image ×××none
mask-origin ×××border-box
mask-position ×××center
mask-repeat ×××no-repeat
mask-size ×××border-box
mask-source-type ×××auto
mask-type ×××luminance
max-height
ボックスの最大の高さを指定する
数値+単位
数値+%
none(なし)
×none
max-lines ×××none
max-width
ボックスの最大の幅を指定する
数値+単位
数値+%
none(なし)
×none
min-height
ボックスの最小の高さを指定する
数値+単位
数値+%
×0
min-width
ボックスの最小の幅を指定する
数値+単位
数値+%
×0
mix-blend-mode ×××normal
move-to ×××normal
nav-down ×××auto
nav-index ×××auto
nav-left ×××auto
nav-right ×××auto
nav-up ×××auto
object-fit ×××fill
object-position ×××50% 50%
opacity
ボックスの透明度を指定する
数値(0~1.0)×××1
order ×××0
orphans ×2
outline ×各々
outline-color ×invert
outline-offset ×××0
outline-style ×none
outline-width ×medium
overflow
ボックスの内容あふれの処理方法を指定
visible(高さ、幅の指定を無視してすべて表示)
hidden(高さ、幅の指定により範囲内のみ表示)
scroll(スクロールバーを表示)
auto(ブラウザーの処理に任せる)
×各々
overflow-wrap ×××normal
overflow-x
ボックスの幅(x軸)の内容あふれの処理方法を指定する
visible(幅の指定を無視してすべて表示)
hidden(幅の指定により範囲内のみ表示)
scroll(スクロールバーを表示)
auto(ブラウザーの処理に任せる)
×××visible
overflow-y
ボックスの高さ(y軸)の内容あふれの処理方法を指定する
visible(高さの指定を無視してすべて表示)
hidden(高さの指定により範囲内のみ表示)
scroll(スクロールバーを表示)
auto(ブラウザーの処理に任せる)
×××visible
padding
パディングの幅をまとめて指定
数値+単位
数値+%
各々
padding-bottom
下パディングを指定する
0
padding-left
左パディングを指定する
0
padding-right
右パディングを指定する
0
padding-top
上パディングを指定する
0
page ××auto
page-break-after ×auto
page-break-before ×auto
page-break-inside ×auto
page-policy ×××start
pause ×実装依存
pause-after ×実装依存
pause-before ×実装依存
perspective ×××none
perspective-origin ×××50% 50%
pitch ××medium
pitch-range ××50
play-during ××auto
polar-anchor ×××50% 50%
polar-angle ×××0
polar-distance ×××0
polar-origin ×××auto
position
要素の配置方法を指定
static(指定なし)
relative(通常配置される位置からの相対的な位置で指定)
absolute(親要素に対して絶対的な位置で指定)
fixed(固定配置で指定)
×static
presentation-level ×××0
quotes ×text
region-fragment ×××auto
resize ×××none
rest ×××各々
rest-after ×××none
rest-before ×××none
richness ××50
right
右からの位置を指定
数値+単位
数値+%
auto
×auto
row-gap ×××normal
ruby-align ×××auto
ruby-merge ×××separate
ruby-position ×××before
scroll-padding ×××0
scroll-padding-block ×××0
scroll-padding-block-end ×××0
scroll-padding-block-start ×××0
scroll-padding-bottom ×××0
scroll-padding-inline ×××0
scroll-padding-inline-end ×××0
scroll-padding-inline-start ×××0
scroll-padding-left ×××0
scroll-padding-right ×××0
scroll-padding-top ×××0
scroll-snap-align ×××none
scroll-snap-margin ×××0
scroll-snap-margin-block ×××0
scroll-snap-margin-block-end ×××0
scroll-snap-margin-block-start ×××0
scroll-snap-margin-bottom ×××0
scroll-snap-margin-inline ×××0
scroll-snap-margin-inline-end ×××0
scroll-snap-margin-inline-start ×××0
scroll-snap-margin-left ×××0
scroll-snap-margin-right ×××0
scroll-snap-margin-top ×××0
scroll-snap-stop ×××normal
scroll-snap-type ×××none
shape-image-threshold ×××0.0
shape-inside ×××auto
shape-outside ×××none
shape-margin ×××0
size ××auto
speak ×auto
speak-as ×××normal
speak-header ××once
speak-numeral ××continuous
speak-punctuation ××none
speech-rate ××medium
stress ××50
string-set ×××none
tab-size ×××8
table-layout
テーブル(表)のレイアウト方法を指定
auto
fixed(列幅を均等)
×auto
text-align
テキストの水平方向位置を指定する
left(左揃え)
center(中央揃え)
right(右揃え)
start
text-align-last ×××auto
text-combine-upright ×××none
text-decoration
テキストの文字装飾を指定する
underline(下線)
overline(上線)
line-through(取り消し線)
none(なし)
none
text-decoration-color ×××currentColor
text-decoration-line ×××none
text-decoration-skip ×××objects
text-decoration-style ×××solid
text-emphasis ×××各々
text-emphasis-color ×××currentColor
text-emphasis-position ×××over right
text-emphasis-style ×××none
text-indent
テキストのインデントを指定する
数値+単位
数値+%
0
text-justify ×××auto
text-orientation ×××mixed
text-overflow ×××clip
text-shadow ××none
text-space-collapse ×××collapse
text-transform none
text-underline-position ×××auto
text-wrap ×××normal
touch-action ×××auto
top
上からの位置を指定
数値+単位
数値+%
auto
×auto
transform ×××none
transform-origin ×××50% 50% 0
transform-style ×××flat
transition ×××各々
transition-delay ×××0s
transition-duration ×××0s
transition-property ×××all
transition-timing-function ×××ease
unicode-bidi ×normal
user-select ×××auto
vertical-align
ボックス内のコンテンツの垂直方向位置を指定する
baseline(ベースライン)
sub(下付き文字)
super(上付き文字)
top(上揃え)
text-top(テキストを基準とした上揃え)
middle(上下中央揃え)
bottom(下揃え)
text-bottom(テキストを基準とした下揃え)
auto
baseline
visibility ×visible
voice-balance ×××center
voice-duration ×××auto
voice-family ×実装依存
voice-pitch ×××medium
voice-range ×××中程度
voice-rate ×××normal
voice-stress ×××normal
voice-volume ×××medium
volume ××medium
white-space normal
widows ×2
width
ボックスの幅を指定する
数値+単位
数値+%
auto
auto
will-change ×××auto
word-break ×××normal
word-spacing normal
word-wrap ×××normal
wrap-flow ×××auto
wrap-through ×××wrap
writing-mode ×××horizontal-tb
z-index
重ね合わせの順序を指定
数値(整数)
auto
×××auto
CSS プロパティ インデックス ·イェンス・オリバー・マイヤート (meiert.com)

疑似クラス

クラス詳細
:link未アクセスであるものを指定する疑似クラス
:visitedアクセス済みであるものを指定する疑似クラス
:hoverマウスでポイントしたオブジェクトを指定する疑似クラス
:focusカーソルがフォーカスしたものを指定する疑似クラス
:activeマウスのボタンが押されているなど、アクティブなオブジェクトを指定する疑似クラス
:nth-child(値)連続するすべての要素(ID、クラスなど含む)の最初から数えた個数の中から番号を指定する疑似クラス。
・値
・数値
・○n+△(○ずつ連続する△番目)
:nth-child(アルファベット値)連続するすべての要素(ID、クラスなど含む)の最初から数えた個数の中から奇数や偶数を指定する疑似クラス
・odd(奇数) :nth-child(odd),nth-child(2n+1)
・even(偶数) :nth-child(even),nth-child(2n)
:nth-child(7)→7 番目の要素を表します。
・4行目以降→ :nth-child(n+4)
nは基本的に0から始まるので、0+4で4行目以降になる
:nth-last-child(値)連続するすべての要素(ID、クラスなど含む)の最後から数えた個数の中から番号を指定する疑似クラス
・数値
・○n+△(○ずつ連続する△番目)
:nth-last-child(アルファベット値)連続するすべての要素(ID、クラスなど含む)の最後から数えた個数の中から奇数や偶数を指定する疑似クラス
・odd(奇数)
・even(偶数)