user346514
user346514

Reputation: 513

html text is not properly formatted

I am looking for an output like below using html

Creative agency:(?) *

I am writing the code something like below...

    <td class="TextLabelForHeader" width="300px">

     Creative Agency:<h6 id="/contracts/HelpContent/Creative%20Agency.txt">()</h6>
     <asp:RequiredFieldValidator ID="RequiredFieldValidatorCreativeAgency" runat="server"
                                 ControlToValidate="txtCreativeAgency" ErrorMessage="*"  ValidationGroup="VGPageGeneral">
</asp:RequiredFieldValidator>
     </td>

But I am getting the output something like below in broswer...

Creative agency: (?) *

Can please someone help me with this....

Thanks

Upvotes: 0

Views: 83

Answers (2)

codingbiz
codingbiz

Reputation: 26386

You can also replace your h6 with an inline element e.g <span>

Creative Agency:<span style="font-weight:bold; font-size:14pt" id="/contracts/HelpContent/Creative%20Agency.txt">()</span>
 <asp:RequiredFieldValidator ID="RequiredFieldValidatorCreativeAgency" runat="server"
                             ControlToValidate="txtCreativeAgency" ErrorMessage="*"  ValidationGroup="VGPageGeneral">

h1..h6 are block element and they occupy all available space of their container forcing other elements in the container to go to next line.

If I may ask why do you have such a funny id on your h6?

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114347

Header tags, such as H6 are block elements. Block elements take up the entire width of their containers.

Either:

Make H6 an inline element using CSS: h6 {display:inline};

or

Use the semantically-correct HTML element for this purpose, in this case a <label>.

Upvotes: 2

Related Questions