刻度的屏幕截图
你好
正如您从我的屏幕截图中看到的那样,我正在尝试让蓝色勾号(这是一种字体样式(转到文本的左侧,而不是像屏幕截图中那样位于文本上方。
这是我的代码,忽略了我也有ionicon v2字体的事实(https://ionicons.com/v2/(:)
我没有写很多帖子,所以请随时询问更多信息。
谢谢大家!
.section-monthly-donations {
background-color: #434343;
}
.plan-box {
background-color: #696969;
border-radius: 5px;
width: 90%;
margin-left: 5%;
}
.plan-box div {
padding: 15px;
border-bottom: 1px solid #424242;
}
.plan-box div:last-child {
text-align: center;
}
.plan-price {
font-size: 190%;
margin-bottom: 10px;
font-weight: 200;
color: #00BFFE;
}
.plan-price span {
font-size: 70%;
font-weight: 300;
}
.plan-box ul {
list-style: none;
}
.plan-box ul li {
font-size: 70%;
padding: 5px 0;
}
.row {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
}
.row:before,
.row:after {
content:"";
display:table;
}
.row:after {
clear:both;
}
/* GRID COLUMN SETUP ==================================================================== */
.col {
display: block;
float:left;
margin: 1% 0 1% 1.6%;
}
.col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */
/* REMOVE MARGINS AS ALL GO FULL WIDTH AT 480 PIXELS */
@media only screen and (max-width: 480px) {
.col {
/*margin: 1% 0 1% 0%;*/
margin: 0;
}
}
/* GRID OF THREE ============================================================================= */
.span-3-of-3 {
width: 100%;
}
.span-2-of-3 {
width: 66.13%;
}
.span-1-of-3 {
width: 32.26%;
}
<section class="section-monthly-donations">
<div class="row">
<h2>Pledge a monthly donation</h2>
</div>
<div class="row">
<div class="col span-1-of-3">
<div class="plan-box">
<div>
<h3>Gold</h3>
<p class="plan-price">£200+ <span>per month</span></p>
</div>
<div>
<ul>
<li><i class="ion-checkmark-round icon-small"></i>Executive letter signed by the team</li>
<li><i class="ion-checkmark-round icon-small"></i>Exclusive access to ...</li>
<li><i class="ion-checkmark-round icon-small"></i>Exclusive ...</li>
<li><i class="ion-checkmark-round icon-small"></i>Sed consequat, leo eget bibendum</li>
</ul>
</div>
<div>
<a href="#" class="btn btn-full-light">Pledge now</a>
</div>
</div>
</div>
</div>
<section>
有两种方法可以在列表项中执行此类图标。
- 您可以向
<li>
中的<i>
元素添加display: inline
,这将使它成为列表项的一部分。然后,如果您想将内容推离图标一点,您可以为其添加边距。 - 如果您不喜欢使用图标换行的文本,另一种方法是使其
position: absolute
,然后将图标放置在使用position: relative
和填充的<li>
内,以便在左侧为图标提供额外的空间。
下面的代码片段说明了两者:
.section-monthly-donations {
background-color: #434343;
}
.plan-box {
background-color: #696969;
border-radius: 5px;
width: 90%;
margin-left: 5%;
}
.plan-box div {
padding: 15px;
border-bottom: 1px solid #424242;
}
.plan-box div:last-child {
text-align: center;
}
.plan-price {
font-size: 190%;
margin-bottom: 10px;
font-weight: 200;
color: #00BFFE;
}
.plan-price span {
font-size: 70%;
font-weight: 300;
}
.plan-box ul {
list-style: none;
}
.plan-box ul li {
font-size: 70%;
padding: 5px 0;
}
/* New CSS */
.plan-box ul li i {
display: inline;
margin-right: 5px;
}
/* End new CSS */
.row {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
}
.row:before,
.row:after {
content:"";
display:table;
}
.row:after {
clear:both;
}
/* GRID COLUMN SETUP ==================================================================== */
.col {
display: block;
float:left;
margin: 1% 0 1% 1.6%;
}
.col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */
/* REMOVE MARGINS AS ALL GO FULL WIDTH AT 480 PIXELS */
@media only screen and (max-width: 480px) {
.col {
/*margin: 1% 0 1% 0%;*/
margin: 0;
}
}
/* GRID OF THREE ============================================================================= */
.span-3-of-3 {
width: 100%;
}
.span-2-of-3 {
width: 66.13%;
}
.span-1-of-3 {
width: 32.26%;
}
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet"/>
<section class="section-monthly-donations">
<div class="row">
<h2>Pledge a monthly donation</h2>
</div>
<div class="row">
<div class="col span-1-of-3">
<div class="plan-box">
<div>
<h3>Gold</h3>
<p class="plan-price">£200+ <span>per month</span></p>
</div>
<div>
<ul>
<li><i class="ion-checkmark-round icon-small"></i>Executive letter signed by the team</li>
<li><i class="ion-checkmark-round icon-small"></i>Exclusive access to ...</li>
<li><i class="ion-checkmark-round icon-small"></i>Exclusive ...</li>
<li><i class="ion-checkmark-round icon-small"></i>Sed consequat, leo eget bibendum</li>
</ul>
</div>
<div>
<a href="#" class="btn btn-full-light">Pledge now</a>
</div>
</div>
</div>
</div>
<section>
.section-monthly-donations {
background-color: #434343;
}
.plan-box {
background-color: #696969;
border-radius: 5px;
width: 90%;
margin-left: 5%;
}
.plan-box div {
padding: 15px;
border-bottom: 1px solid #424242;
}
.plan-box div:last-child {
text-align: center;
}
.plan-price {
font-size: 190%;
margin-bottom: 10px;
font-weight: 200;
color: #00BFFE;
}
.plan-price span {
font-size: 70%;
font-weight: 300;
}
.plan-box ul {
list-style: none;
}
/* Adjusted CSS */
.plan-box ul li {
position: relative;
font-size: 70%;
padding: 5px 0 5px 15px;
}
/* End adjusted CSS */
/* New CSS */
.plan-box ul li i {
position: absolute;
left: 0;
}
/* End new CSS */
.row {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
}
.row:before,
.row:after {
content:"";
display:table;
}
.row:after {
clear:both;
}
/* GRID COLUMN SETUP ==================================================================== */
.col {
display: block;
float:left;
margin: 1% 0 1% 1.6%;
}
.col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */
/* REMOVE MARGINS AS ALL GO FULL WIDTH AT 480 PIXELS */
@media only screen and (max-width: 480px) {
.col {
/*margin: 1% 0 1% 0%;*/
margin: 0;
}
}
/* GRID OF THREE ============================================================================= */
.span-3-of-3 {
width: 100%;
}
.span-2-of-3 {
width: 66.13%;
}
.span-1-of-3 {
width: 32.26%;
}
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet"/>
<section class="section-monthly-donations">
<div class="row">
<h2>Pledge a monthly donation</h2>
</div>
<div class="row">
<div class="col span-1-of-3">
<div class="plan-box">
<div>
<h3>Gold</h3>
<p class="plan-price">£200+ <span>per month</span></p>
</div>
<div>
<ul>
<li><i class="ion-checkmark-round icon-small"></i>Executive letter signed by the team</li>
<li><i class="ion-checkmark-round icon-small"></i>Exclusive access to ...</li>
<li><i class="ion-checkmark-round icon-small"></i>Exclusive ...</li>
<li><i class="ion-checkmark-round icon-small"></i>Sed consequat, leo eget bibendum</li>
</ul>
</div>
<div>
<a href="#" class="btn btn-full-light">Pledge now</a>
</div>
</div>
</div>
</div>
<section>