Relative Positioning & Fixed Sizing in ASCX Controls

Discussion in 'ASP .Net Web Controls' started by Alex Maghen, May 6, 2006.

  1. Alex Maghen

    Alex Maghen Guest

    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
     
    Alex Maghen, May 6, 2006
    #1
    1. Advertising

  2. Alex Maghen

    gerry Guest

    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



    "Alex Maghen" <> wrote in message
    news:...
    > 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
     
    gerry, May 6, 2006
    #2
    1. Advertising

  3. 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.
     
    Steven Cheng[MSFT], May 8, 2006
    #3
  4. 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.)
     
    Steven Cheng[MSFT], May 10, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Quentin
    Replies:
    1
    Views:
    489
    Quentin
    Jul 29, 2003
  2. Tim Marsden

    Sizing and positioning of dynamic controls

    Tim Marsden, Feb 25, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    2,971
    Steven Cheng[MSFT]
    Mar 2, 2004
  3. PJ6

    relative sizing does not nest?

    PJ6, Aug 15, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    342
  4. KatB
    Replies:
    8
    Views:
    4,194
  5. Nikolai Prokoschenko

    Mouse position in both fixed and relative positioning

    Nikolai Prokoschenko, May 17, 2011, in forum: Javascript
    Replies:
    2
    Views:
    1,063
    darwinist
    May 18, 2011
Loading...

Share This Page