html - 如何在 css/html 中实现这种风格?
问题描述
我目前正在开发一个网站并尝试实现这种风格:
图标带有圆形圆圈(完成)的地方,图标。但我的问题来自文本。在下图中,我猜我们将它与文本左对齐,但一切都完美契合,每个文本之间的空格,对齐。
但是当我尝试做同样的事情时,它看起来是这样的:
忽略右侧(准备好后我将复制粘贴左侧)
正如你们所看到的,文本不断断线,并且不像原始图像那样居中。
继承人的代码:
.wrapper {
display: flex;
text-align: center;
}
.block {
width: 50%;
}
.lista-fazemos {
list-style-type: none!important;
padding: 0;
margin: 0;
text-align: right;
}
.circle {
display: inline-block;
border-radius: 60px;
border-color: black;
box-shadow: 0px 0px 2px #888;
padding: 0.5em 0.6em;
font-size: 20px;
color: #A52222;
margin-right: 15px;
}
.homem-fazemos {
float: right;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
<div class="wrapper">
<div class="block">
<ul class="lista-fazemos">
<li>
<i class="fas fa-wrench circle"></i>
<strong>Instalação</strong><br> Fazemos instalação de produtos comprados em nossa loja sem custo adicional!
<br>
</li>
<li>
<i class="fas fa-truck circle"></i>
<strong>Instalação</strong><br> Mora longe? Sem problemas, temos serviços de entrega que irão te satisfazer! <br>
</li>
<li>
<i class="fas fa-plus circle"></i>
<strong>Instalação</strong><br>Aqui somos nota + em qualidade! Pode ficar tranquilo, temos os melhores produtos! <br>
</li>
</ul>
</div>
<div class="block">
<ul class="lista-fazemos">
<li>
<i class="fas fa-wrench circle"></i> Texto texto Texto texto<br>
</li>
<li>
<i class="fas fa-truck circle"></i> texto texto texto texto <br>
</li>
<li>
<i class="fas fa-plus circle"></i> texto texto texto texot <br>
</li>
</ul>
</div>
</div>
谢谢,对不起我的英语不好。
解决方案
ul {
list-style: none
}
li {
width: 50%;
float: left;
margin-bottom:2%;
}
.circle {
display: inline-block;
border-radius: 60px;
border-color: black;
box-shadow: 0px 0px 2px #888;
padding: 0.5em 0.6em;
font-size: 20px;
color: #A52222;
margin-right: 15px;
}
.col-container {
display: table;
/* Make the container element behave like a table */
width: 100%;
/* Set full-width to expand the whole page */
}
.col {
vertical-align: top;
text-align: top;
display: table-cell;
/* Make elements inside the container behave like table cells */
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
<ul class="col-container">
<li>
<div class="col">
<i class="fas fa-wrench circle"></i>
</div>
<div class="col">
<strong>Instalação</strong><br> Fazemos instalação de produtos comprados em nossa loja sem custo adicional!
</div>
</li>
<li>
<div class="col">
<i class="fas fa-truck circle"></i>
</div>
<div class="col">
<strong>Instalação</strong><br> Mora longe? Sem problemas, temos serviços de entrega que irão te satisfazer!
</div>
</li>
<li>
<div class="col">
<i class="fas fa-plus circle"></i>
</div>
<div class="col">
<strong>Instalação</strong><br>Aqui somos nota + em qualidade! Pode ficar tranquilo, temos os melhores produtos!
</div>
</li>
</ul>
推荐阅读
- python - python cProfile/snakeviz 无法处理调用同一函数的多个函数
- javascript - 将 JavaScript 日期转换为格式化字符串
- android - 使用简单日期格式解析日期时出现空指针异常
- mysql - 为什么它会在mysql中引发语法错误
- python - 使用 python / requests 表单处理 google recaptcha
- spring-boot - 在没有模拟的情况下测试 REST API 提供程序响应
- django - 将 Django 用户与另一个用户相关联
- reactjs - Webpack 4.8 和 Babel 7 在生产中编译后不起作用
- angular - 合作 Angular IO 项目
- c# - EF核心不在迁移方法上创建表