Html 中断半行 <br>
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24467036/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make a half row break <br>
提问by t3cho
If i want to remove the space between rows of those two element's how would i do that. Example:
如果我想删除这两个元素的行之间的空间,我会怎么做。例子:
Example 1 http://pokit.org/get/img/6be8921b47ff746c1bf297cf87ab0950.jpg
示例 1 http://pokit.org/get/img/6be8921b47ff746c1bf297cf87ab0950.jpg
If i remove the <br>
it would be like this then this is how it looks like:
如果我删除<br>
它,它会是这样的,那么它是这样的:
Example 2 http://pokit.org/get/img/1924cb8a9b344bb4f4eda1a98760fd3e.jpg
示例 2 http://pokit.org/get/img/1924cb8a9b344bb4f4eda1a98760fd3e.jpg
The rows are to close one to other. I wonder how can i make like half of the <br>
tag . If you understand my question ?
行将彼此关闭。我想知道我怎么能做出一半的<br>
标签。如果你明白我的问题?
The space between two rows should be less than in example 1. but higher then in example 2.
两行之间的间距应小于示例 1。但高于示例 2。
This is code used
这是使用的代码
<span class="tekst">Sie besuchten Düsseldorf als:</span><br>
<select name="posjeta" class="optiontekst">
<option>- bitte w?hlen -</option>
<option>Gesch?ftsreisende</option>
<option>Privatperson</option>
</select>
<br><br>
And the class tekst
和班级考试
.tekst{
font-family: 'Bree Serif', serif;
color: #2980b9;
}
I know i didn't explained well but i tried my best.
我知道我没有很好地解释,但我尽力了。
回答by Syx
The <br>
tag just adds in a standard line break to the document. You can adjust the size of the <br>
element in your CSS:
该<br>
标签只是在文档中添加了一个标准的换行符。您可以<br>
在 CSS 中调整元素的大小:
br {
line-height: 10px;
}
Or you can use a trick with <hr>
; setting the height and making it invisible
或者你可以使用一个技巧<hr>
;设置高度并使其不可见
<hr style="height:10px; visibility:hidden;" />
回答by Chuck Bevitt
If you only want to do it in one place, you can apply line-height directly to the
element as: <br style="line-height: 10px" />
如果您只想在一个地方执行此操作,则可以将 line-height 直接应用于
元素,如下所示:<br style="line-height: 10px" />
回答by jcaron
A few options:
几个选项:
- add a
margin-bottom
orpadding-bottom
to the element on top - add a
margin-top
to the select
- 在顶部的元素上添加一个
margin-bottom
或padding-bottom
margin-top
在选择中添加一个
There are probably many other possibilities to achieve this.
可能还有许多其他可能性来实现这一目标。
回答by web-tiki
You can use margins :
您可以使用边距:
HTML :
HTML :
<span class="tekst">Sie besuchten Düsseldorf als:</span>
<select name="posjeta" class="optiontekst">
<option>- bitte w?hlen -</option>
<option>Gesch?ftsreisende</option>
<option>Privatperson</option>
</select>
<br>
<br>
CSS :
CSS :
.tekst {
font-family:'Bree Serif', serif;
color: #2980b9;
display:block;
margin-bottom:10px; /* adapt the margin value to the desire space between span and select box */
}
回答by Kalpesh Prajapati
add a margin-bottom span element
添加边距底部跨度元素
OR
或者
add a margin-top to the select element
为 select 元素添加一个 margin-top
For example:
例如:
tekst {
margin-bottom: 10px;
}
OR
或者
optiontekst {
margin-top: 10px;
}
回答by J Prakash
HTML :
HTML :
<span class="tekst">Sie besuchten Düsseldorf als:</span>
<select name="posjeta" class="optiontekst">
<option>- bitte w?hlen -</option>
<option>Gesch?ftsreisende</option>
<option>Privatperson</option>
</select>
<br><br>
CSS :
CSS :
.tekst{
font-family: 'Bree Serif', serif;
color: #2980b9;
margin-bottom: 10px;
padding-bottom: 10px;
}
Try this code it will work for you.
试试这个代码它会为你工作。