我是CSS新手。我正在尝试创建一个提供每种服务状态的网站。
像这样的东西 https://status.hipchat.com/
我对CSS没有太多的经验,所以我试图了解我可以使用chrome inspector做些什么,并创建了以下CSS。但是,间距看起来不太合适。
body {
font-family: "proxima-nova", "Helvetica Neue", Helvetica, Arial, Sans-Serif;
font-weight: 400;
background-color: #ffffff;
font-size: 16px;
line-height: 24px;
color: #333;
background: #fff;
-webkit-font-smoothing: subpixel-antialiased;
}
.legend {
display: flex;
display: -ms-flexbox;
flex-direction: row;
justify-content: space-between;
position: relative;
top: -2px;
}
.legend-item {
flex: 0 0 auto;
font-size: .875rem;
position: relative;
color: #aaa;
opacity: 0.8;
}
.border-color {
border-color: #e9e9e9;
}
.component-container {
border-radius: 4px 4px 4px 4px !important;
-moz-border-radius: 4px 4px 4px 4px !important;
-webkit-border-radius: 4px 4px 4px 4px !important;
-o-border-radius: 4px 4px 4px 4px !important;
-ms-border-radius: 4px 4px 4px 4px !important;
width: 100%;
float: none;
border-width: 1px;
padding: 1.1rem 1.25rem 1rem;
border-style: solid;
margin: 10px
}
.name {
vertical-align: middle;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: inline-block;
font-weight: 500;
max-width: 75%;
}
.component-status {
display: inline-block;
font-size: 0.875rem;
float: right;
}
.color-success {
color: #36b37e;
}
.color-warning {
color: #BCBE2A
}
.shared-partial.uptime-90-days-wrapper {
padding-top: 5px;
margin-bottom: -2px;
}
.spacer {
flex: 1;
margin: 0.75rem 1rem 0 1rem;
height: 1px;
background: #aaa;
opacity: 0.3;
}
<div class="component-container border-color">
<div class="shared-partial uptime-90-days-wrapper"><span class="name"> testing </span><br><span class="component-status color-success">Operational</span><svg
height="34">
<rect height="34" width="3" x="5" y="0" fill="#bcbe2a"></rect>
<rect height="34" width="3" x="10" y="0" fill="#36b37e"></rect>
<rect height="34" width="3" x="15" y="0" fill="#36b37e"></rect>
</svg>
<div class="legend">
<div class="legend-item">90 days ago</div>
<div class="spacer"></div>
<div class="legend-item">96.67% uptime </div>
<div class="spacer"></div>
<div class="legend-item">today</div>
</div>
</div>
</div>