【发布时间】:2019-07-14 03:02:14
【问题描述】:
我正在制作一个网站,除了一些文字外,我还想在其中添加一些边框。在它上面,一些图标。我想要的是边框只占据LinkedIn文本的文本区域,而不是整个班级。我试过position: absolute,但一无所获。
.contactSocial {
display: flex;
justify-content: space-between;
align-items: center;
}
.facebook:before {
display: flex;
justify-content: center;
content: "\f39e";
font-family: "Font Awesome 5 Brands";
font-weight: 900;
color: blue;
}
.linkedIn {
border-right: 2px solid green;
border-left: 2px solid green;
}
.linkedIn:before {
display: flex;
justify-content: center;
content: "\f0e1";
font-family: "Font Awesome 5 Brands";
font-weight: 900;
color: blue;
}
.instagram:before {
display: flex;
justify-content: center;
content: "\f16d";
font-family: "Font Awesome 5 Brands";
font-weight: 900;
color: blue;
}
<head><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
</head>
<div class="contactSocial">
<div class="facebook">Facebook</div>
<div class="linkedIn">LinkedIn</div>
<div class="instagram">Instagram</div>
</div>
【问题讨论】:
-
在 CSS3 中引入了伪元素使用双冒号。在这种情况下,它将变为
::before和::after。仅供参考。
标签: html css flexbox alignment