how to

J

Joker7

Hi one and all,

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

Cheers
Chris
 
E

Ed Jay

Joker7 said:
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">
 
J

Joker7

:
: >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
 
M

Mazin07

Joker7 said:
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%;
}
 
S

Spartanicus

Mazin07 said:
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.
 
J

Joker7

:
: >> 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
 
A

Andrew Cameron

Ed said:
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
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top