0

刻度的屏幕截图
您好,
从我的屏幕截图中可以看出,我试图让蓝色刻度(这是一种字体样式)位于文本的左侧,而不是像屏幕截图中那样位于文本上方。
这是我的代码,忽略了我也有 ionicons 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>

4

1 回答 1

0

有两种方法可以在列表项中执行这样的图标。

  1. 您可以添加display: inline<i>元素中<li>,使其成为列表项的一部分。然后,如果您想将内容推离图标一点,则可以为其添加边距。
  2. 如果您不喜欢用图标环绕的文本,另一种方法是制作它position: absolute,然后将图标放置在<li>使用position: relative和填充的内部,以便在左侧为图标提供额外空间。

下面的片段来说明两者:

.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>

于 2019-12-31T16:41:27.830 回答