CSSのborder-styleプロパティ
CSS border-styleプロパティは、要素の境界線スタイルを指定するために使用されます。また、border-topスタイル、border-rightスタイル、border-leftスタイル、border-rightスタイルのプロパティを使用して、個々の辺の境界線スタイルを定義することもできます。
構文
CSSボーダープロパティの構文は次のとおりです-
Selector {
border: /*value*/
} 次の例は、CSSボーダースタイルのプロパティ-
を示しています。例
<!DOCTYPE html>
<html>
<head>
<style>
div:first-of-type {
margin: 5% 0 0 20%;
}
div {
height: 40px;
width: 40px;
margin: auto;
padding: 10px;
border-style: solid;
display: flex;
float: left;
}
#d1 {
border-style: double dashed;
}
#d2 {
border-style: dotted;
}
</style>
</head>
<body>
<div></div>
<div id="d1"></div>
<div id="d2"></div>
</body>
</html> 出力
これにより、次の出力が得られます-
例
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin: 20px;
float: left;
height: 80px;
width: 60px;
border-style: ridge;
border-width: 1.2em;
border-color: midnightblue;
border-bottom-left-radius: 50%;
}
div + div {
height: 120px;
width: 80px;
border-style: double;
border-color: seagreen;
border-right-width: 180px;
border-bottom-right-radius: 100%;
}
</style>
</head>
<body>
<div></div>
<div></div>
</body>
</html> 出力
これにより、次の出力が得られます-
-
CSSのマージン短縮プロパティ
CSSのmarginshorthandプロパティは、要素のマージン領域を定義するために使用されます。時計回りに値を設定します。つまり、margin-top、margin-right、margin-bottom、margin-leftの順に設定します。 構文 CSSマージンプロパティの構文は次のとおりです- Selector { margin: /*value*/ } 次の例は、CSSマージンの短縮プロパティ-を示しています。 例 <!DOCTYPE html> <html> <head> <style> div {
-
CSSのmax-heightプロパティ
CSSのmax-heightプロパティを使用して、要素のコンテンツボックスに固定の最大高さを定義できます。これにより、高さがmax-heightよりも大きい場合でも、要素のコンテンツボックスを高くすることはできません。 構文 CSSのmax-heightプロパティの構文は次のとおりです- Selector { max-height: /*value*/ } CSSのmax-heightプロパティの例を見てみましょう- 例 <!DOCTYPE html> <html> <head> <title>CSS max-hei