如何停用< br> tags in< div>由css? [英] How to disable <br> tags inside <div> by css?
问题描述
< br>
不会让我在内联显示3个按钮,所以我需要禁用它在div,我不能只是删除它们,他们
< div style =display:block>
< p>一些文字< / p>
< br>
< p>一些文字< / p>
< br>
< / div>
我想要:
< div style =display:block>
一些文本一些文本
< / div>
更多信息
我不想有mystyle.css文件。
当然我知道禁用它的方式。
我问如何添加到divs风格这个 br {display:none;
ol>
< p>
标签,而不删除其中的内容。< br>
,因此我这样做:
< style type =text / css>
.mydiv {
display:block;
width:100%;
height:10px;
}
.mydiv br {
display:none;
}
< / style>
< div class =mydiv>
一些文本
一些文本
< / div>
例如
div p,
div br {
display:inline;
}
或 - 我的评论者指出:
div br {
display:none;
}
但是为了实现你想要的示例,修剪 p
向下,因此:
div br {
display:none;
}
div p {
padding:0;
margin:0;
}
<br>
won't let me to display 3 buttons inline, so i need to disable it inside div, and I can't just delete them, they are automatically there.
I have:
<div style="display:block">
<p>Some text</p>
<br>
<p>Some text</p>
<br>
</div>
and I want:
<div style="display:block">
Some text Some text
</div>
More info
I do not want to have mystyle.css file. Of course I know that way of disabling it.
I asked how to add to divs style this br { display: none; }
if it is possible.
Solution:
- It is not possible to remove just
<p>
tags without removing content inside. - It is not possible to hide
<br>
directly by divs style, so I make it this way:
<style type="text/css"> .mydiv { display: block; width: 100%; height: 10px; } .mydiv br { display: none; } </style> <div class="mydiv"> Some text Some text </div>
You could alter your CSS to render them less obtrusively, e.g.
div p,
div br {
display: inline;
}
or - as my commenter points out:
div br {
display: none;
}
but then to achieve the example of what you want, you'll need to trim the p
down, so:
div br {
display: none;
}
div p {
padding: 0;
margin: 0;
}
这篇关于如何停用< br> tags in< div>由css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!