Center aligned with set width.

Status
Not open for further replies.

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Hello,

I'm having some trouble with CSS.
It seems that I can use "text-align:center;" only with elements that I have not set a width for.
When I set a width for an element, it moves over to the left.
But when I take the width off, it moves back to the middle.

Does anyone have a fix for this?

Thanks in advance.
 

Queef

Some people...
Jul 27, 2012
645
289
I'm using this for now.
Although I'd prefer a CSS alternative.


As far as i am aware there is no alternative for <center> tags in the form of CSS without the content positioning being pushed out due to sizing.

I don't see whats wrong with using <center> tags.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
As far as i am aware there is no alternative for <center> tags in the form of CSS without the content positioning being pushed out due to sizing.

I don't see whats wrong with using <center> tags.


I'd just prefer consistency.
The majority of my pages (all except this one) use CSS "text-align:center;".
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
I'd just prefer consistency.
The majority of my pages (all except this one) use CSS "text-align:center;".

Simples, give the text the attribute of <p> and then in the css use something like the following:

Code:
div.style p {
margin:0 auto;
} /* Obv the rest of the styles you are willing to add

If you don't understand, just ask. Not sure if I've explained it too well.
 
  • Like
Reactions: NSA
Status
Not open for further replies.

Users who are viewing this thread

Top