/    Sign up×
Community /Pin to ProfileBookmark

position text inside an <a>

Hi,

when <a> is defined as display:block, is it possible to position the text inside? lets say i have this code:

[code=html].block a { display:block;width:50px;height:50px;background-color:blue; }

<table>
<td class=”block”>
hello
</td>
</table>[/code]

by default the text would appear on the very top of the blue square, but what if i want it somewhere else like the right bottom corner or so? i tried by placing a DIV inside the <a> and set margins or padding but it wont work right on inters.hi.t explorer (as usual). Any ideas?

Thank you.

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@cootheadJun 16.2011 — Hi there supercain,

try it like this...
[color=navy]
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta name="language" content="english"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;

&lt;title&gt;&lt;/title&gt;

&lt;style type="text/css"&gt;
a {
position:relative;
display:block;
width:50px;
height:50px;
background-color:#00f;
color:#f0f0f0;
}
a span {
position:absolute;
right:0;
bottom:0;
}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div&gt;
&lt;a href="#"&gt;&lt;span&gt;text&lt;/span&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@supercainauthorJun 17.2011 — Thank you, that was a very useful advice.
Copy linkTweet thisAlerts:
@cootheadJun 17.2011 — [indent]No problem, you're welcome. ?[/indent]
×

Success!

Help @supercain spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...