「CSS」border-top-colorで上枠の色を指定する

環境

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Google Chrome 103.0.5060.134
Windows 10 Home 64bit
Google Chrome 103.0.5060.134 Windows 10 Home 64bit
Google Chrome 103.0.5060.134
Windows 10 Home 64bit

構文
border-top-color:値
上の境界線の色を定義します。
border-top-colorを指定して、上枠の色を設定します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<head>
<style>
#cft {
border: 30px solid #333 ;
border-top-color: #8A2BE2 ;
max-width: 50% ;
height: 100px ;
line-height: 100px ;
text-align: center ;
margin: 20px auto 0 ;
}
</style>
</head>
<body>
<div id="cft">this is a test data</div>
</body>
</html>
<!DOCTYPE html> <html> <head> <style> #cft { border: 30px solid #333 ; border-top-color: #8A2BE2 ; max-width: 50% ; height: 100px ; line-height: 100px ; text-align: center ; margin: 20px auto 0 ; } </style> </head> <body> <div id="cft">this is a test data</div> </body> </html>
<!DOCTYPE html>
<html>
<head>
<style>
#cft {
      border: 30px solid #333 ;
      border-top-color: #8A2BE2 ;
    
      max-width: 50% ;
      height: 100px ;
      line-height: 100px ;
      text-align: center ;
      margin: 20px auto 0 ;
}

</style>
</head>
<body>

<div id="cft">this is a test data</div>
</body>
</html>

実行結果
スタイルシートのborder-top-colorを指定して上枠の色が「#008080」になります。

CSS

Posted by arkgame