如何删除div内的空白区域

时间:2018-02-10 21:43:05

标签: html css twitter-bootstrap

如何删除日期文字周围的顶部,按钮,左右空格? 我想让div只包含没有任何空格的文本,但仍然有响应

.fit {
    width: fit-content;
    /* To adjust the height as well */
    height: fit-content;
}
#Topspace {
    margin-top: 50px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div  id="Topspace" >
<div class="well col-sm-6 col-xs-6 col-md-6 col-lg-6">

    <div class=" fit well col-sm-3 col-xs-3 col-md-3 col-lg-3" style="background-color:grey;margin-top:-50px;">
        <p class="" style="word-wrap: break-word;
">DD/MM/YY</p>
    </div>


</div>
</div>

3 个答案:

答案 0 :(得分:0)

“我想让div只包含没有任何空格的文本,但仍然有响应。”

哪个div?如果你从第三个div中删除它会怎么样?

margin-top:-50px;

你需要的是什么?你的问题很难说清楚。

答案 1 :(得分:0)

尝试设置容器div的max-width

.fit.well {
padding: 0;
max-width: 30px;
}

.fit {
    width: fit-content;
    /* To adjust the height as well */
    height: fit-content;
}
#Topspace {
    margin-top: 50px;
}
.fit.well {
    padding: 0;
    max-width: 30px;
    }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div  id="Topspace" >
<div class="well col-sm-6 col-xs-6 col-md-6 col-lg-6">

    <div class=" fit well col-sm-3 col-xs-3 col-md-3 col-lg-3" style="background-color:grey;margin-top:-50px;">
        <p class="" style="word-wrap: break-word;
">DD/MM/YY</p>
    </div>


</div>
</div>

答案 2 :(得分:0)

我解决了这个问题,只是我使用了背景颜色和边框用于pragragh

&#13;
&#13;
.fit{ width: fit-content; 
  /* To adjust the height as well */ 
  height: fit-content;}</style>
&#13;
<p class=" fit" style="background-color:grey;word-wrap: break-word;border:solid;border-color:grey">
3/feb/2018
</p>
&#13;
&#13;
&#13;