标题栏完全冲到顶部的框
box with a title bar completely flushed to the top
我需要创建一个包含内容的盒子。我尝试以这种方式创建盒子,但它并不安静我需要的是:
.main-box {
border-radius: 25px;
border: 2px solid #000;
padding: 20px;
width: 70%;
margin-left: 20%;
}
.box-title {
background-color: #5b5b39;
padding: 5px;
color: #fff;
font-weight: bold;
}
.box-content {
padding-left: 10px;
padding-right: 10px;
}
这是上面样式的样子 sheet:
我被要求创建这样的东西:
我不希望边框和标题之间有任何 space 并且标题栏应该完全齐平框的顶部。
.box {
border: 1px solid black;
border-radius: 10px;
}
.header-wrapper {
border: 1px solid black;
background-color: lightblue;
border-radius: 10px 10px 0 0;
padding-left: 10px;
}
<div class="box">
<div class="header-wrapper">
<h2>Order Details</h2>
</div>
<div class="content">
<ul>
<li>item a</li>
<li>item a</li>
<li>item a</li>
</ul>
</div>
</div>
我需要创建一个包含内容的盒子。我尝试以这种方式创建盒子,但它并不安静我需要的是:
.main-box {
border-radius: 25px;
border: 2px solid #000;
padding: 20px;
width: 70%;
margin-left: 20%;
}
.box-title {
background-color: #5b5b39;
padding: 5px;
color: #fff;
font-weight: bold;
}
.box-content {
padding-left: 10px;
padding-right: 10px;
}
这是上面样式的样子 sheet:
我被要求创建这样的东西:
我不希望边框和标题之间有任何 space 并且标题栏应该完全齐平框的顶部。
.box {
border: 1px solid black;
border-radius: 10px;
}
.header-wrapper {
border: 1px solid black;
background-color: lightblue;
border-radius: 10px 10px 0 0;
padding-left: 10px;
}
<div class="box">
<div class="header-wrapper">
<h2>Order Details</h2>
</div>
<div class="content">
<ul>
<li>item a</li>
<li>item a</li>
<li>item a</li>
</ul>
</div>
</div>