このように見えるように内側の境界線をどのように配置しますか。
私の内側の境界線 div には境界線スタイルが含まれています。
.container {
max-width: 980px;
height: auto;
margin: 0 auto;
width: 100%;
}
.border {
background: white;
border-radius: 50%;
height: 300px;
}
.innerborder {
border-style: dashed;
height: 200px;
border-radius: 50%;
}
<body style="background: black;">
<div class="container">
<div class="border">
<div class="innerborder">
</div>
</div>
</div>
</body>
私が試した CSS は、画像に関連する出力を生成していないようです。CSSを使用してこれを達成する他の方法はありますか? 助けてください。
以下のように、を使用pseudo selector :before
してdashed border
内部.container
に作成することをお勧めします。
body{
background:#111;
}
.container{
width:400px;
height:400px;
border-radius:50%;
background:#fff;
margin:auto;
position:relative;
}
.container:before{
content:"";
width:380px;
height:380px;
position:absolute;
border:1px dashed #111;
border-radius:50%;
top:9px;
left:9px;
}
<div class="container">
</div>
あなたのコードはうまく動作しますが、padding to .border
.inner-border の高さを増減するだけ.container to 400px
で、適切な円になるように高さを変更しました。
.container {
height: 400px;
margin: 0 auto;
width: 400px;
}
.border {
background: white;
border-radius: 50%;
height: 365px;
width:380px;
padding:10px;
}
.innerborder {
border-style: dashed;
height: 360px;
border-radius: 50%;
}
<body style="background: black;">
<div class="container">
<div class="border">
<div class="innerborder">
</div>
</div>
</div>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加