我想制作一份在Windows command prompt
中运行命令的指南。
.bold-cli {
float: left;
padding: 20px;
margin: 20px 30px;
font-family: Arial;
font-style: italic;
font-weight: bold;
background-color: black;
color: white;
}
<div class="bold-cli">
C:\> Rundll32 %windir%\system32\dfshim.dll CleanOnlineAppCache
</div>
我希望div
只占用足够的空间来显示命令,而不是水平拉伸,所以我添加了float: left
。
问题是,此div之后的内容不是以新行开头,而是显示在右侧。
答案 0 :(得分:0)
.bold-cli {
float: left;
padding: 20px;
margin: 20px 30px;
font-family: Arial;
font-style: italic;
font-weight: bold;
background-color: black;
color: white;
}
<p>To fix this, start a command prompt, type the following command and then press Enter.</p>
<div class="bold-cli">
C:\> Rundll32 %windir%\system32\dfshim.dll CleanOnlineAppCache
</div>
<span style="float:left;clear: both;">We have build a utility to run this command for you. <a href="https://stackoverflow.com/" style="color: #DB5523;">Click me</a></span>
答案 1 :(得分:0)
添加clearfix
div,如下所示,以移除影响下一个元素的浮动。
.bold-cli {
float: left;
padding: 20px;
margin: 20px 30px;
font-family: Arial;
font-style: italic;
font-weight: bold;
background-color: black;
color: white;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
<div class="bold-cli">
ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC AB ABC ABC ABC ABC
</div>
<div class="clearfix">
</div>
Start from new line