0

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

4

2 回答 2

2

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

于 2012-10-25T21:26:51.970 回答
0

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?

于 2012-10-25T21:39:43.397 回答