View Full Version : align center problem
loki
06-09-2005, 14:48/02:48PM
i don't do enough CSS these days to learn, let alone remember what i've learnt!
once again i'm stuck on the old align center problem.
i'm writing:
a.imp2:link {
font: bold 11px Arial, Helvetica, sans-serif;
color: #FFFFFF;
margin:0;
text-align: center}
for a aref class=imp2 , but it still aligns left.
can someone help please?
Connie
06-09-2005, 15:12/03:12PM
The easiest way to do it is make a class .center {text-align: center;} and then use <p class="center">
chrishirst
06-09-2005, 15:37/03:37PM
An Anchor <a ... > is an inline element and as such only occupies the same space as it's content.
So it can't actually align anywhere.
You will have apply the text-align:center to the parent block level element as in Connies example.
loki
06-09-2005, 15:58/03:58PM
thanks for the replies.
i think i understand what you're saying (and yes chris you've told me before) but i'm not too clear on this.
:(
will have to do some experimenting on this tomorrow.
thanks
sytemaker
07-09-2005, 09:37/09:37AM
I think what he means is that a link (<a href="blabla">) is part of the main content just like any other text. In other words it could be a word in the middle of a paragraph or any other text division. If you want to align some anchor text separately you need to wrap <a href="blabla">text</a> inside either a <p></p> tag or a <div></div> tag for example and add a class to those as Connie suggested.
g1smd
07-09-2005, 13:14/01:14PM
If you make your page out of headings, paragraphs, lists, tables, and forms, and then style each of those blocks, your job will become much easier. You then only need to use a class when a block needs a different style to the default you used for all the others.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.