gpt4 book ai didi

html - 在中心对齐 div 文本对齐不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 20:14:14 26 4
gpt4 key购买 nike

我希望圆在 768 网格中居中对齐

Demo

HTML

<div class="About_Container">
<div class="Icon_Wrapper">
<div class="Circle">
<div class="CircleWrapper"> <span class="Icon">
<img src="http://livedemo00.template-help.com/drupal_50108/sites/default/files/icon-service-3.png" /> </span>
<span class="Text"> CUSTOMER GUARANTEEE </span> </div>
</div>
</div>
<div class="Text_Wrapper"> Vestibulum quis felis ut enim aliquam iaculis.
Nullam pharetra tortor at quam viverra volutpat.
Phasellus vel faucibus dolor. Curabitur ac ni
i non metus dignissim dapibus eu vel nibh. Phasellus </div>
<div class="Link_Wrapper"> <a href="#">READ MORE</a> </div>
</div>

CSS

@media ( min-width: 120px) and (max-width:768px) {

#Container_About {
min-height: 1291px;
background: #404040;
width: 100%;
float: left;
}

.TradeSlogan {
font-size: 60px;
line-height: 66px;
font-family: 'Open Sans', sans-serif;
color: #fff;
margin-bottom: 25px;
font-weight: 800;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline;
}

.SomeTextWrapper {
color: #949393;
margin: 10px;
}

.SomeTextWrapper .SomeTextWrapper:before, .SomeTextWrapper:after {
content: " "; /* 1 */
display: table; /* 2 */
}

.SomeTextWrapper:after { clear: both; }

/**
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/

.SomeTextWrapper { *zoom: 1;
}

.About_Container {
height: 100%;
width: 100%;
}

.Circle {
margin: 10px;
height: 170px;
width: 170px;
border-radius: 170px;
background: #949393;
display: table-cell;
vertical-align: middle;
text-align: center;
}

.Icon_Wrapper {
text-align: left;
height: 100%;
width: 100%;
}

.CircleWrapper { padding: 10px; }

.CircleWrapper Icon, Text {
float: left;
height: 44%;
width: 100%;
margin: 3%;
}

.Text {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #03c7de;
font-weight: 600;
font-size: 15px;
letter-spacing: 1.5px;
}

.Text_Wrapper {
margin: 25px;
color: #03c7de;
font-weight: 300;
font-size: 11px;
letter-spacing: 1.5px;
}

.Link_Wrapper {
padding: 20px;
text-align: right;
}

.Link_Wrapper a {
color: #03c7de;
font-weight: 300;
font-size: 17px;
letter-spacing: 1.5px;
}

最佳答案

.Icon_Wrapper {
text-align: left;
height: 100%;
width: 170px;
margin: auto;
}

因为我们知道圆的宽度我们可以让圆的容器 (.Icon_Wrapper) 有它的宽度并通过 margin:auto 将它对齐到页面的中心

Updated Fiddle

关于html - 在中心对齐 div 文本对齐不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24570353/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com