本日も私が何回もやり方を調べてしまっているCSSをまとめて記載します。
基本的なCSSですが、コピペで対応できるように備忘録しておくことによって、コーディング速度の向上を図ります。
■画像ファイルを中央繰り返し表示せず動かないように固定して、さらに背景を大きさによって調整できるようにする。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background: url(bg.jpg) center center / cover no-repeat fixed; | |
} |
■使用する画像の角に丸みをつける。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a{ | |
border-radius: 5px; | |
} |
■テキスト部分に下線を付ける。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
span{ | |
text-decoration: underline; | |
} |
■テキストの背面にシャドウを付ける。(今回水色)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
span{ | |
text-shadow: | |
0 2px 0 #F00, | |
2px 0 0 #F00, | |
0 -1px 0 #F00, | |
-1px 0 0 #F00, | |
-1px -1px 0 #F00, | |
2px -1px 0 #F00, | |
-1px 2px 0 #F00, | |
2px 2px 0 #F00; | |
} |
■非表示にする。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
span{ | |
display:none; | |
} |
★完成★
レスポンシブデザイン時に「display:none;」を使う場面もおおくありますが、コーディング技術向上の為、極力使わないようにしましょう。