how to

Discussion in 'HTML' started by Joker7, Dec 4, 2005.

  1. Joker7

    Joker7 Guest

    Hi one and all,

    How to convert <div align="center"> to work in a css file .

    Cheers
    Chris
     
    Joker7, Dec 4, 2005
    #1
    1. Advertising

  2. Joker7

    Ed Jay Guest

    "Joker7" <> wrote:

    >Hi one and all,
    >
    >How to convert <div align="center"> to work in a css file .
    >

    Inline:
    <div style="margin-left:auto;margin-right:auto;">

    Or you can define a class in your style sheet:

    ..XYZ {margin-left:auto;margin-right:auto;}

    then write your div as:
    <div class="XYZ">

    --
    Ed Jay (remove M to respond by email)
     
    Ed Jay, Dec 4, 2005
    #2
    1. Advertising

  3. Joker7

    Joker7 Guest

    "Ed Jay" <> wrote in message
    news:...
    : "Joker7" <> wrote:
    :
    : >Hi one and all,
    : >
    : >How to convert <div align="center"> to work in a css file .
    : >
    : Inline:
    : <div style="margin-left:auto;margin-right:auto;">
    :
    : Or you can define a class in your style sheet:
    :
    : .XYZ {margin-left:auto;margin-right:auto;}
    :
    : then write your div as:
    : <div class="XYZ">
    :
    : --
    : Ed Jay (remove M to respond by email)

    Cheers
    Chris
     
    Joker7, Dec 4, 2005
    #3
  4. Joker7

    Mazin07 Guest

    Joker7 wrote:
    > Hi one and all,
    >
    > How to convert <div align="center"> to work in a css file .
    >
    > Cheers
    > Chris
    >
    >
    >
    >


    Sometimes, if you know the width of a certain <div> for sure, you can do
    something like this:

    div.content {
    width:600px;
    margin-left:-300px;
    position:absolute;
    left:50%;
    }
     
    Mazin07, Dec 4, 2005
    #4
  5. Joker7

    Spartanicus Guest

    Mazin07 <> wrote:

    >> How to convert <div align="center"> to work in a css file .

    >
    >Sometimes, if you know the width of a certain <div> for sure, you can do
    >something like this:
    >
    >div.content {
    > width:600px;
    > margin-left:-300px;
    > position:absolute;
    > left:50%;
    >}


    Please don't give any more "advice" until you get a clue yourself.

    --
    Spartanicus
     
    Spartanicus, Dec 4, 2005
    #5
  6. Joker7

    Joker7 Guest

    "Spartanicus" <> wrote in message
    news:...
    : Mazin07 <> wrote:
    :
    : >> How to convert <div align="center"> to work in a css file .
    : >
    : >Sometimes, if you know the width of a certain <div> for sure, you can do
    : >something like this:
    : >
    : >div.content {
    : > width:600px;
    : > margin-left:-300px;
    : > position:absolute;
    : > left:50%;
    : >}
    :
    : Please don't give any more "advice" until you get a clue yourself.
    :
    : --
    : Spartanicus

    Yeah I knew now how to set width ect but not how to center it to the page..

    Cheers
    Chris
     
    Joker7, Dec 4, 2005
    #6
  7. Ed Jay wrote:
    > "Joker7" <> wrote:
    >
    >
    >>Hi one and all,
    >>
    >>How to convert <div align="center"> to work in a css file .
    >>

    >
    > Inline:
    > <div style="margin-left:auto;margin-right:auto;">
    >
    > Or you can define a class in your style sheet:
    >
    > .XYZ {margin-left:auto;margin-right:auto;}
    >
    > then write your div as:
    > <div class="XYZ">


    Remember to tag the container with text-align: center for silly IE...

    Andrew Cameron
     
    Andrew Cameron, Dec 5, 2005
    #7
    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.

Share This Page