Relative Positioning & Fixed Sizing in ASCX Controls

A

Alex Maghen

I'm trying to make a tiny login-block control that I'll use here and there. I
had tried creating the ASCX and making the outer-most object an <asp:panel>
object with a style that contains position: relative. Then, I placed all the
little text boxes, etc inside that panel with absolute positioning.

I also used properties such as height and width of the text boxes and font
sizes, etc. to make everything fit just right.

In the VS environment, everything looks great, but when I load the thing in
the browser, the text boxes aren't the same small size that they had been,
they overlap with each other a little, and the Button control isn't the same
size either.

I thought that this might be because a style-sheet overrode the specific
settings on the control but, first of all, I thought that the specific
settings on the control are supposed to override the CSS. Also, my CSS
doesn't have any settings in it for INPUT or BUTTON.

Any idea what's going on here?

Alex
 
G

gerry

relative positioning is relative to the position that the item would have
had with normal flow.
absolute positioning is absolute relative to the top left corner of the web
page NOT the top left corner of the parent object

i'm not sure what use relative positioning is on the outer container
absolute positioning on the contained objects will almost certainly move
them outside of their container.

html inline styles override css styles, both override html attributes

are you sure that your .css is having any effect at all ?

can you post the html or a linkg to the page ?

Gerry
 
S

Steven Cheng[MSFT]

Thanks for Gerry's input.

Hi Alex,

Yes, as Gerry has mentioned, the relative or absolute position mode on web
page are all based on the whole page's scope(espeically for absolute mode).
When we use absolute position for html elements (or asp.net server
controls), no matter they are put in page's top level or nested in other
container controls, their final calculated position is aligned with the
while page's start point rather than its parent container. Also, for web
page, I always suggest use relative position(flow layout), it can make the
page display flexible when user sizing the browser window.

BTW, as for VS IDE's design-view for web page does differents some from its
runtime displayed version. This is because the designer need to make the
design-view convenient for user to edit/modify it. For example, when we
nest one html table in another, if we set the same width and heigh for
them, the IDE will still display some padding space between them so that we
can select each of them to do some modification.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steven Cheng[MSFT]

Hey Alex,

Any further progress on this issue? If there is still anything we can help,
please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top