navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

text align in a link

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> text align in a link
Page: [1]
 
milo3169

 

Posts: 40
Joined: 4/26/2005
From: Dallas, TX
Status: offline

 
text align in a link - 8/22/2005 12:31:57   
Can I put a text-align in a <a href> Tag? If so, I do I do that?:)
Tailslide

 

Posts: 6046
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: text align in a link - 8/22/2005 13:58:39   
It won't work as the link is an "inline element" and text:align only works on "block level elements". This however does:

Either

<p style="text-align:center;"><a href="index.html" >Click here</a></p>


or better still:

in your document head or external stylesheet:

<STYLE TYPE="text/css">
<!--
.centeralign {text-align:center}
-->
</STYLE>


Then in the HTML

<p class="centeralign"><a href="index.html" >Click here</a></p>


You're thinking what's the difference. Difference is with the style declared separately you can change it and it will change all over the page (or site if the style's external) whereas doing it inline (in the p tag) you have to change every one.


_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to milo3169)
milo3169

 

Posts: 40
Joined: 4/26/2005
From: Dallas, TX
Status: offline

 
RE: text align in a link - 8/22/2005 14:18:01   
That is what my problem is. I wanted to be able to align the link to the right inline with the text. But you are not able to do that?

(in reply to Tailslide)
Tailslide

 

Posts: 6046
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: text align in a link - 8/22/2005 14:26:52   
Ah! Lightbulb moment!

You can't use text:align BUT you can float a link like this:

<a style="float:right;" href="#">Click here</a>


You just need to be a bit careful about positioning the float - you might need to move it around a bit to get it exactly right.

Edit: again as with the last example it'd be better to do it like this:

<STYLE TYPE="text/css">
<!--
.rightalign {float:right}
-->
</STYLE>


then

<a class="rightalign" href="yourlink.html">Click here</a>




_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to milo3169)
milo3169

 

Posts: 40
Joined: 4/26/2005
From: Dallas, TX
Status: offline

 
RE: text align in a link - 8/22/2005 14:41:43   
Thanks Tailslide,

I will give that a try and see what happens

(in reply to Tailslide)
d a v e

 

Posts: 4087
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: text align in a link - 8/22/2005 15:51:34   
i think you might need to float it in a div...

<div class="rightalign">
<a class="rightalign" href="yourlink.html">Click here</a>
</div>

_____________________________

David Prescott
Gekko web design

(in reply to milo3169)
milo3169

 

Posts: 40
Joined: 4/26/2005
From: Dallas, TX
Status: offline

 
RE: text align in a link - 8/22/2005 16:03:19   
I have tried all of your suggestions, it does align right, but not in line with the text. It will put it on the next line. I'm not that this can be done.

(in reply to d a v e)
Tailslide

 

Posts: 6046
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: text align in a link - 8/22/2005 16:10:08   
Strictly speaking they don't need to be inside anything - floats will work on any un-positioned element be they inline or block.

It is always a good idea to have them inside a div or a table or something otherwise they try to float off the screen!

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to d a v e)
d a v e

 

Posts: 4087
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: text align in a link - 8/22/2005 16:14:10   
of course - that's true!

anyway this works for me
http://members.tiscali.fi/dave_pirjo/test-area/css_stuff/rightalign.htm

_____________________________

David Prescott
Gekko web design

(in reply to Tailslide)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> text align in a link
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts