Search code examples
htmlgsp

How Do I Use More Than One Style On HTML Label?


The following HTML code works on my GSP to make the label bold, but I'd also like to assign a bottom-margin.

Here is the current code for my label:

<label class="control-label col-sm-6" style="font-weight: bold;" for="customerSection">
                    Most Updated Customer Information Available
</label>

I would also like to set the following style on this label:

style="margin-bottom: 0.3cm"

However I have not needed to assign both to a single label yet. How would I go about assigning both the bold style and the margin-bottom style to this label?


Solution

  • The ; symbol in CSS (the programming language by which styles are written in) means an end of a statement. Meaning; to change multiple styles you must simply separate them by this symbol.

    Amended HTML :

    <label class="control-label col-sm-6" style="font-weight: bold; margin-bottom: 1em;" for="customerSection">
                        Most Updated Customer Information Available
    </label>
    

    For sizing, use em, px, or %.

    An additional way of doing bold is also to surround the text in tags, instead - such as :

    <label class="control-label col-sm-6" style="margin-bottom: 1em;" for="customerSection">
                            <strong>Most Updated Customer Information Available</strong>
    </label>