CSS question

Discussion in 'HTML' started by DrewC, Aug 14, 2007.

  1. DrewC

    DrewC Guest

    I am trying to position a block in my CSS and I want it to when I resize the
    browser window the margin on both sides remain the same. But I can only get
    the left side to behave this way
    DrewC, Aug 14, 2007
    #1
    1. Advertising

  2. DrewC

    Animesh K Guest

    DrewC wrote:
    > I am trying to position a block in my CSS and I want it to when I resize the
    > browser window the margin on both sides remain the same. But I can only get
    > the left side to behave this way
    >
    >


    To get the answer, please give a link to your website. It is hard to
    know what does your CSS file looks like.
    Animesh K, Aug 14, 2007
    #2
    1. Advertising

  3. DrewC

    DrewC Guest

    http://drewclayton.com/test.htm

    #top2 {
    padding: 10px;
    border: 5px solid #ccc;
    background: #666;
    height: 100px; /* ie5win fudge begins */
    voice-family: "\"}\"";
    voice-family:inherit;
    height: 46px;
    width: 352px;
    margin-top: 20px;
    margin-right: 20px;
    margin-bottom: 0px;
    margin-left: 20px;
    position: absolute;
    left: 130px;
    top: 163px;
    }


    Thats the code for the block. It keeps the margin on the right as I resize
    the window, but the right doesn't behave the same way

    >
    > To get the answer, please give a link to your website. It is hard to know
    > what does your CSS file looks like.
    DrewC, Aug 14, 2007
    #3
  4. DrewC

    John Hosking Guest

    DrewC wrote:
    > I am trying to position a block in my CSS and I want it to when I resize the
    > browser window the margin on both sides remain the same. But I can only get
    > the left side to behave this way


    When you (1) provide a URL as Animesh suggests, you can also (2) explain
    what you mean by "remain the same": do you mean the same as each other,
    or the same as they were before resizing? Also, you may wish to (3) post
    your CSS topics to comp.infosystems.www.authoring.stylesheets.


    --
    John
    Pondering the value of the UIP: http://blinkynet.net/comp/uip5.html
    John Hosking, Aug 14, 2007
    #4
  5. Scripsit DrewC:

    > I am trying to position a block in my CSS and I want it to when I
    > resize the browser window the margin on both sides remain the same.
    > But I can only get the left side to behave this way


    Set margin-left: auto and margin-right: auto. Make sure you have a
    conforming doctype that puts browsers into "standards" mode, and a) accept
    the fact that a fraction of old browsers don't center the block or b) use
    HTML tools for centering.

    Of course, you need to set a width for the block for this to work. If you
    just want, say, 3em margins on both sides and the block to occupy the rest
    of the available width, simply set margin-left: 3em and margin-right: 3em
    (or just margin: 0 3em if it its OK to explicitly set vertical margins to
    zero).

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Aug 14, 2007
    #5
  6. DrewC

    Animesh K Guest

    DrewC wrote:
    > http://drewclayton.com/test.htm
    >
    > #top2 {
    > padding: 10px;
    > border: 5px solid #ccc;
    > background: #666;
    > height: 100px; /* ie5win fudge begins */
    > voice-family: "\"}\"";
    > voice-family:inherit;
    > height: 46px;
    > width: 352px;
    > margin-top: 20px;
    > margin-right: 20px;
    > margin-bottom: 0px;
    > margin-left: 20px;
    > position: absolute;
    > left: 130px;
    > top: 163px;
    > }
    >
    >
    > Thats the code for the block. It keeps the margin on the right as I resize
    > the window, but the right doesn't behave the same way
    >
    >> To get the answer, please give a link to your website. It is hard to know
    >> what does your CSS file looks like.

    >
    >


    Please bottom post to keep the context.

    Your html file is almost empty so it is unclear what you desire to
    achieve. Also, link to your CSS file using relative directory structure.
    file:///c\........ will work only on your computer, not on the server.

    Best,
    Animesh
    Animesh K, Aug 14, 2007
    #6
  7. DrewC

    DrewC Guest


    > Your html file is almost empty so it is unclear what you desire to
    > achieve. Also, link to your CSS file using relative directory structure.
    > file:///c\........ will work only on your computer, not on the server.



    yes, I know that. I just want to know how to achive it before I upload it
    DrewC, Aug 14, 2007
    #7
  8. DrewC

    dorayme Guest

    In article <f9t377$ikl$>,
    "DrewC" <> wrote:

    > > Your html file is almost empty so it is unclear what you desire to
    > > achieve. Also, link to your CSS file using relative directory structure.
    > > file:///c\........ will work only on your computer, not on the server.

    >
    >
    > yes, I know that. I just want to know how to achive it before I upload it


    You want the egg to come first?

    --
    dorayme
    dorayme, Aug 14, 2007
    #8
  9. DrewC

    Animesh K Guest

    DrewC wrote:
    >> Your html file is almost empty so it is unclear what you desire to
    >> achieve. Also, link to your CSS file using relative directory structure.
    >> file:///c\........ will work only on your computer, not on the server.

    >
    >
    > yes, I know that. I just want to know how to achive it before I upload it
    >
    >
    >


    Yes but your html file has only one div. You mentioned that you want to
    position two columns. Can you post the full thing (however awful it is,
    don't worry)?
    Animesh K, Aug 14, 2007
    #9
  10. DrewC

    Neredbojias Guest

    Well bust mah britches and call me cheeky, on Tue, 14 Aug 2007 19:32:18
    GMT DrewC scribed:

    > I am trying to position a block in my CSS and I want it to when I
    > resize the browser window the margin on both sides remain the same.
    > But I can only get the left side to behave this way


    Here are some excerpts from your posts to date:

    (1) I am trying to position a block in my CSS and I want it to when I
    resize the browser window the margin on both sides remain the same. But I
    can only get the left side to behave this way

    - Meaning you can only get the left side to remain the same as ...? What?

    (2) Thats the code for the block. It keeps the margin on the right as I
    resize the window, but the right doesn't behave the same way

    - How many right hands do _you_ possess?

    (3) yes, I know that. I just want to know how to achive it before I upload
    it

    - If the solution to your problem necessitates uploading it first, your
    "want" is irrational.

    Anyway, Jukka seems to have the answer. To keep consistently-sized side
    margins, you can't include a container width. When I first read your post,
    I had the same question as John Hosking asked. Whether English is your
    native language or not, you should try to present your queries in better
    fashion in the future.

    --
    Neredbojias
    Half lies are worth twice as much as whole lies.
    Neredbojias, Aug 15, 2007
    #10
    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. Eric
    Replies:
    4
    Views:
    695
    clintonG
    Dec 24, 2004
  2. tom watson

    print.css and screen.css

    tom watson, Sep 9, 2003, in forum: HTML
    Replies:
    1
    Views:
    450
    Jukka K. Korpela
    Sep 9, 2003
  3. Replies:
    6
    Views:
    533
    Jonathan N. Little
    Mar 18, 2006
  4. AF
    Replies:
    17
    Views:
    575
    Nije Nego
    Aug 9, 2006
  5. richard
    Replies:
    12
    Views:
    736
    dorayme
    Mar 9, 2010
Loading...

Share This Page