I use " " to add non-break space between two controls in html.
Is there another way to do it?
Printable View
I use " " to add non-break space between two controls in html.
Is there another way to do it?
if there was, we wouldn't need the entity.
The only other way is to set the margin of one or both control in the CSS.
-tg
hay,
actually why you need another way?
another way to add white space is by using the <pre> tag like so:
:)Code:<pre>hello :)(: world</pre>
It is A way... may or may not be the best way... but it is A way....
-tg
:) :p
Hey, do not dis the almighty PRE tag! :p
he asked about ways and she provide another
http://www.w3schools.com/tags/tag_pre.asp
may be this is the thing he is looking for, but he have to till us why he is looking for it
I tried but <pre> only works for text.
What I want to do is adding 100 space between two lables like below:
<asp:Label ID="lbl1" runat="server" /> <asp:Label ID="lbl2" runat="server"/>
If I use <pre> will make lbl2 in next line which I do not like it.
<asp:Label ID="lbl1" runat="server" />
<pre><asp:Label ID="lbl2" runat="server"/></pre>
do you have enough space ? maybe that is the reason it's break.
and as tg suggested the more common way of doing this is to set lbl1 margin-right to 100px (or what ever space you need)
note: the label you are using will be rendered has <span> tag so you can only apply left-right margin
like so:
Code:<style type='text/css'>
#lbl1 {margin:0 100px 0 0;}
</style>
aspfun - I think the suggestion was to put pre tag BETWEEN your labels... not to put one label inside the pre tag...
I dunno... something still doesn't feel quite right about this...
What's the reason for the 100 spaces?
-tg
I Haven't noticed your code sample but yes i mean to use it like this:
but i still will go with the margin-right CSS property.Code:<asp:Label ID="lbl1" runat="server" />
<pre> </pre>
<asp:Label ID="lbl2" runat="server"/>
motil, I tried your code but it make lbl2 in next line.
i think that's mean that the container of the two labels is to small for space size you're trying to add.
Can you post all the code that you are using?
Gary
Here is code. There are 10 views in MultiView but I test in view1
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
<table width="870" cellpadding="0" cellspacing="0">
<tr valign="top">
<td >
<br />
<br />
<asp:Label ID="lbl1" runat="server" Text="111"/>
<pre> </pre>
<asp:Label ID="lbl2" runat="server" Text="222"/>
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
Okay, so this is very much related to your other thread that you have here:
http://www.vbforums.com/showthread.php?t=628879
In there, the recommendation was that you use CSS to control your layout.
Gary
Yes, I'll do CSS. I think that this is the only way.