在里面我有文字,p标签也在div标签里面,我需要tex才能响应。
这是我的html和css代码
<div class="row">
<div class="col-md-4">
<div id="box4">
<p><a href="#" class="texto4">Brigadistas</a></p>
</div>
</div>
<div class="col-md-4">
<div id="box5">
<p><a href="#" class="texto5">Copasst</a></p>
</div>
</div>
<div class="col-md-4">
<div id="box6">
<p><a href="#" class="texto6">Normatividad</a></p>
</div>
</div>
</div>
#box4 p a{
text-align: center;
position: relative;
width: 100%;
bottom: 63px;
left: 57px;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 20px;
color: white;
}
#box5 p a{
text-align: center;
position: relative;
width: 100%;
bottom: 63px;
left: 57px;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 20px;
color: white;
}
#box6 p a {
text-align: center;
position: relative;
bottom: 63px;
left: 57px;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 20px;
color: white;
}
当浏览器调整大小时,p标记内的文本位于div之外。
我使用宽度:100%但没有任何反应。
问题解决了。谢谢!我用了 %
#box4,#box5,#box6{
width: 60%;
background:rgba(43,86,162,1.00);
margin-top:34%;
padding-top: 34%;
margin-bottom: 14%;
position: relative;
left:24%;
border-radius:12%;
border:5px solid rgb(178,205,73);
}
#box4 p a{
text-align: center;
position: absolute;
width: 100%;
bottom: 33%;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 140%;
color: white;
}
#box5 p a{
text-align: center;
position: absolute;
width: 100%;
bottom: 33%;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 140%;
color: white;
}
#box6 p a {
text-align: center;
position: absolute;
width: 100%;
bottom: 33%;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 140%;
color: white;
如果使用flex只需要它:justify-content: center
确保父级是flex。在这种情况下,不需要使用职位。