简体   繁体   中英

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

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> .

You can also replace your h6 with an inline element eg <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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM