Why can't I left-justify my links?

M

Mike Silva

Newbie confusion here. I have a CSS style (#rightcolumn) with text-
align: center. Then I have a CSS link style as follows:

#rightcolumn a {
color: #333;
font-size: small;
text-align: left;
text-decoration: none;
}

But the links remain centered in the column (or rather, they obey the
text-align in #rightcolumn whatever it is set to). All the other
styles work (color, font-size, etc) but text-align: left has no
effect. Any ideas on what I'm doing wrong? Thanks.

Mike
 
R

rf

Mike said:
Newbie confusion here. I have a CSS style (#rightcolumn) with text-
align: center. Then I have a CSS link style as follows:

#rightcolumn a {
color: #333;
font-size: small;
text-align: left;
text-decoration: none;
}

Text-align is for block elements and <a> isn't one.
 
R

richard

Newbie confusion here. I have a CSS style (#rightcolumn) with text-
align: center. Then I have a CSS link style as follows:

#rightcolumn a {
color: #333;
font-size: small;
text-align: left;
text-decoration: none;
}

But the links remain centered in the column (or rather, they obey the
text-align in #rightcolumn whatever it is set to). All the other
styles work (color, font-size, etc) but text-align: left has no
effect. Any ideas on what I'm doing wrong? Thanks.

Mike

Try putting the link inside of a span and justify the span.
<span style="text-align:left"><a>link</a></span>
 
A

Adrienne Boswell

Try putting the link inside of a span and justify the span.
<span style="text-align:left"><a>link</a></span>

No, span is still inline, as is a. What is needed is either a block
level element, or:
#rightcolumn a {display:block;....}
 
R

rf

Adrienne said:
No, span is still inline, as is a. What is needed is either a block
level element, or:
#rightcolumn a {display:block;....}

Hey, but with the "try" approach we would have eventually got to that. After
trying all HTML elements and then trying all CSS properties until a
combination was found that worked :)
 
D

dorayme

Mike Silva said:
Newbie confusion here. I have a CSS style (#rightcolumn) with text-
align: center. Then I have a CSS link style as follows:

#rightcolumn a {
color: #333;
font-size: small;
text-align: left;
text-decoration: none;
}

But the links remain centered in the column (or rather, they obey the
text-align in #rightcolumn whatever it is set to). All the other
styles work (color, font-size, etc) but text-align: left has no
effect. Any ideas on what I'm doing wrong? Thanks.

<http://netweaver.com.au/centring/>

might help in respect to text-align.
 
M

Mike Silva

Gazing into my crystal ball I observed richard <[email protected]>
writing in






No, span is still inline, as is a.  What is needed is either a block
level element, or:
#rightcolumn a {display:block;....}
Thanks, not only did that do the trick, but I even understand why it
works - doesn't get any better than that!

Mike
 
H

Harlan Messinger

Mike said:
Newbie confusion here. I have a CSS style (#rightcolumn) with text-
align: center. Then I have a CSS link style as follows:

#rightcolumn a {
color: #333;
font-size: small;
text-align: left;
text-decoration: none;
}

But the links remain centered in the column (or rather, they obey the
text-align in #rightcolumn whatever it is set to). All the other
styles work (color, font-size, etc) but text-align: left has no
effect. Any ideas on what I'm doing wrong? Thanks.
The text-align attribute applies to a block element to indicate the
alignment of inline content in that block. Try removing the text-align
attribute above and instead adding

#rightcolumn { text-align: left; }
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top