Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在HTML标签上使用多个样式?_Html_Gsp - Fatal编程技术网

如何在HTML标签上使用多个样式?

如何在HTML标签上使用多个样式?,html,gsp,Html,Gsp,下面的HTML代码在我的GSP上工作,以使标签加粗,但我还想指定一个底部边距 以下是我的标签的当前代码: <label class="control-label col-sm-6" style="font-weight: bold;" 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>
但是,我还不需要将这两个标签都指定给一个标签。如何将粗体样式和页边距底部样式分配给此标签?


<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不是一个好的实践。我建议你在不同的文件或同一个文件中的“样式”标签中给出如下所有样式

label.control-label.col-sm-6{
边缘底部:0.3cm;
字体大小:粗体;
浮动:左;
}

提供的最新客户信息

为什么不将
控件标签
类和样式与CSS(或其他选择器)一起使用?只有代码的答案通常可以从一些解释性文本中受益。在这种情况下,您可以讨论它的工作原理以及是否存在任何限制,甚至可以建议有更好的方式来处理样式。
<label class="control-label col-sm-6" style="margin-bottom: 1em;" for="customerSection">
                        <strong>Most Updated Customer Information Available</strong>
</label>