[英]Adding color to br
I want to give <br />
some color.我想给<br />
一些颜色。 but it is not getting applied但它没有得到应用
Here is the HTML这是HTML
<br style="color:#EAEFF5" />
here is the screenshot.这是屏幕截图。 I want the white space to be colored我想要给白色空间着色
UPDATE更新
<div style="background-color:#EAEFF5; width:100%;" style="border: 1px solid black; border-collapse:collapse;" cellpadding="5px" cellspacing="2px">
<table width="60%" cellpadding="5px" style="border: 1px solid black; border-collapse:collapse;" cellspacing="1px" align="center">
<tr>
<th class="label" style="font-size: 120%; font-family: Courier New; text-align:center">
Date
</th>
<th class="label" style="width: 7%; font-size: 120%; font-family: Courier New;text-align:center">
Flat Status
</th>
<th class="label" style="width: 7%; font-size: 120%; font-family: Courier New;text-align:center">
Comments
</th>
</tr>
<tr>
<td class="label" style="width: 7%; font-size: 120%; font-family: Courier New;text-align:center;">
<input type="text" runat="server" id="txtdate" style="width: 75px;"/>
</td>
<td class="label" style="width: 7%; font-size: 120%; font-family: Courier New;text-align:center;">
<%--<input id="txtcomments" type="text" runat="server" style="width: 75px;" />--%>
<select id="ddlflatstatus" style="width: auto" name="flatstatus" runat="server">
<option value="0">--- Select ---</option>
</select>
</td>
<td class="label" style="width: 7%; font-size: 120%; font-family: Courier New;text-align:center;">
<%--<input id="txtstatusdet" type="text" runat="server" style="width: 75px;" />--%>
<asp:TextBox ID="txtcomments" runat="server" Width="150" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table></div>
<br style="background-color:#EAEFF5" />
In HTML, you should never add styles to a whitespace character, which is what <br>
effectively is.在 HTML 中,您永远不应该将样式添加到空白字符,这实际上是<br>
。
Rather use a separator:而是使用分隔符:
<div style="height: 10px; background-color: #EAEFF5"></div>
It's not guaranteed to get uniform styling for <br>
across all the browsers so I suggest you use a div
with empty content and style that accordingly.不能保证在所有浏览器中为<br>
获得统一的样式,因此我建议您使用内容为空的div
并相应地设置样式。
<h1>Some Text</h1>
<div class="breaker"></div>
<p> Some Paragraph</p>
CSS CSS
.breaker{
color : red;
border : 1px solid green;
margin-bottom : 5px;
}
Here's a Pen to help you realize these changes.这是一支笔,可帮助您实现这些变化。
this should work这应该工作
<br/>
<div style="background-color:lightgray;color:lightgray"><br/></div>
<br/>
You can't give br a color.你不能给 br 一种颜色。 A possible solution would be to use some a custom class on an empty element and then style that element using CSS.一种可能的解决方案是在空元素上使用一些自定义类,然后使用 CSS 设置该元素的样式。
For Example:例如:
HTML HTML
<span class="custom-br"></span>
CSS CSS
.custom-br {
display:block;
width: 100%;
height: 5px;
background-color: #cb0009; /*change color*/
}
Instead of using <br>
you can use DIV like this:您可以像这样使用 DIV 而不是使用<br>
:
<div>Some text</div>
<div style="background-color:##EAEFF5;height:10px;"></div>
<div>This is under the break</div>
instead of coloring there add this而不是在那里着色添加这个
<div style="background-color:#EAEFF5 !important;>
you should use !important你应该使用 !important
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.