/    Sign up×
Community /Pin to ProfileBookmark

Div alignment

Okay, so what I’m trying to do is align one element of text in the center and one element on the right, but both on the same line, without using table tags. I don’t know if this is possible but any help would be greatly appreciated.

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@waffleauthorFeb 27.2006 — Umm.. is there a way to do it without using exact pixels? I tried looking at the tutorials but they all seemed to describe things that I did not want done. This is all inside of a table and the table can be varying sizes depending on the data inside of it. I want it so there is text that is aligned in the center of the td and text that is aligned on the right side of the td. I figured divs would be the easiest way to do this but I'm not exactly sure now... could you give me a working code example? Thanks for your time.
Copy linkTweet thisAlerts:
@waffleauthorFeb 27.2006 — Uhh i think i got it, this is what I did if anyone wants to know the same thing.
[code=html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#container
{
}
#leftnav
{
float: left;
}

#rightnav
{
float: right;
width: 200px;
}

#content
{
margin-left: 200px;
margin-right: 200px;
}

</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<div id="container">
<div id="leftnav">
</div>
<div id="rightnav" align="right">aaweb
</div>
<div id="content" align="center">
<h2>Subheading</h2>
</div>
</div>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@ray326Feb 27.2006 — I believe align is deprecated.
Copy linkTweet thisAlerts:
@KravvitzFeb 27.2006 — It is. It seems that waffle forgot to remove those when s/he added the CSS.
×

Success!

Help @waffle 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.18,
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,
)...