如何在 HTML 标签上使用多个样式?
How Do I Use More Than One Style On HTML Label?
以下 HTML 代码在我的 GSP 上运行,使标签 粗体 ,但我还想分配一个底边距。
这是我的标签的当前代码:
<label class="control-label col-sm-6" style="font-weight: bold;" for="customerSection">
Most Updated Customer Information Available
</label>
我还想在此标签上设置以下样式:
style="margin-bottom: 0.3cm"
但是我还不需要将两者都分配给一个标签。我将如何为这个标签指定粗体样式和边距底部样式?
<label class="control-label col-sm-6" style="font-weight: bold;margin-bottom: 0.3cm" for="customerSection">
Most Updated Customer Information Available </label>
您可以在分号后添加更多css语法
<label class="control-label col-sm-6" style="font-weight: bold;margin-bottom: 0.3cm;" for="customerSection">
Most Updated Customer Information Available
</label>
; CSS(编写样式的编程语言)中的符号表示语句的结束。意义;要更改多个样式,您只需用此符号将它们分开。
修正HTML:
<label class="control-label col-sm-6" style="font-weight: bold; margin-bottom: 1em;" for="customerSection">
Most Updated Customer Information Available
</label>
对于大小,请使用 em、px 或 %。
另一种加粗的方法是将文本包围在标签中,而不是 - 例如:
<label class="control-label col-sm-6" style="margin-bottom: 1em;" for="customerSection">
<strong>Most Updated Customer Information Available</strong>
</label>
您应该像下面那样添加所有 css,因为内联 css 不是一个好习惯。我建议你在 "style" 标签
内的不同文件或同一文件中提供如下所有样式
label.control-label.col-sm-6 {
margin-bottom: 0.3cm;
font-weight: bold;
float: left;
}
<label class="control-label col-sm-6" for="customerSection">
Most Updated Customer Information Available
</label>
以下 HTML 代码在我的 GSP 上运行,使标签 粗体 ,但我还想分配一个底边距。
这是我的标签的当前代码:
<label class="control-label col-sm-6" style="font-weight: bold;" for="customerSection">
Most Updated Customer Information Available
</label>
我还想在此标签上设置以下样式:
style="margin-bottom: 0.3cm"
但是我还不需要将两者都分配给一个标签。我将如何为这个标签指定粗体样式和边距底部样式?
<label class="control-label col-sm-6" style="font-weight: bold;margin-bottom: 0.3cm" for="customerSection">
Most Updated Customer Information Available </label>
您可以在分号后添加更多css语法
<label class="control-label col-sm-6" style="font-weight: bold;margin-bottom: 0.3cm;" for="customerSection">
Most Updated Customer Information Available
</label>
; CSS(编写样式的编程语言)中的符号表示语句的结束。意义;要更改多个样式,您只需用此符号将它们分开。
修正HTML:
<label class="control-label col-sm-6" style="font-weight: bold; margin-bottom: 1em;" for="customerSection">
Most Updated Customer Information Available
</label>
对于大小,请使用 em、px 或 %。
另一种加粗的方法是将文本包围在标签中,而不是 - 例如:
<label class="control-label col-sm-6" style="margin-bottom: 1em;" for="customerSection">
<strong>Most Updated Customer Information Available</strong>
</label>
您应该像下面那样添加所有 css,因为内联 css 不是一个好习惯。我建议你在 "style" 标签
内的不同文件或同一文件中提供如下所有样式label.control-label.col-sm-6 {
margin-bottom: 0.3cm;
font-weight: bold;
float: left;
}
<label class="control-label col-sm-6" for="customerSection">
Most Updated Customer Information Available
</label>