Why do CONTROLS end with an EXTRA line-break/space???

M

michael

On my ASP.NET pages, it seems that _after_ any web or user control - an
extra (small) line break or space is inserted automatically right after the
Control. This is unwanted since it messes up vertical alignment preventing
me of having things "touch" each other. I have tried surrounding the
controls in a DIV tag with padding set to 0 but this still does not help.

What must I do to prevent this line-break or space to happen after a
web/user control?

Thanks in advance
 
C

C-Sharper or C-Hasher, one of the two

What happens if you specifiy the height of the div and hide the overflow
(CSS) i.e. style="height:100px;overflow:hidden;", assuming that your control
has a fixed height?

Greg
 
B

Bret Mulvey [MS]

Are you sure you're not adding it yourself? Here's an example:

<div>
<my:control runat="server">
some stuff
</my:control>
</div>

There's a CR/LF after the control (before the end of the div) but it's not
the control that's putting it there--it's right there in the HTML. To
suppress this you would need to do

<div>
<my:control runat="server">
some stuff
</my:control></div>
 
M

michael

No ... my code looks like this

<div>
<my:control runat="server">some stuff</my:control></div>
 
Joined
Jun 25, 2012
Messages
4
Reaction score
0
The problem is that asp.net inserts a line break in th HTML after the control. I don't mean a <br> tag but a simple line return ni the text of th html.

Browsers interpret this line as a space, so they include a text space.

SOLUTION: Set the font size of that area to zero. That way even though the browser will insert a space, it will measure 0 pixels.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top