/    Sign up×
Community /Pin to ProfileBookmark

Need help with div

Simple problem I guess, but I can’t seem to figure out why.
I’m using two seperate div’s to split a page (one naviagational, one content)
This is my CSS

[CODE]/* CSS Document */
body
{
background-color: #000;
color: #FFF
}
div#alpha
{
float: left;
width: 10%;
height: 100%;
margin: 0;
border-top: none;
border-right: 2px solid #333;
border-bottom: 2px solid #333
}
div#beta
{
float: left;
width: 80%;
height: 100%;
margin: 0;
text-align: center
}[/CODE]

See the widths on them, 10% and 80%, this makes the text center as it should be, but if I ajust it to fit 100%, it uncenters. Example.

[CODE]/* CSS Document */
body
{
background-color: #000;
color: #FFF
}
div#alpha
{
float: left;
width: 10%;
height: 100%;
margin: 0;
border-top: none;
border-right: 2px solid #333;
border-bottom: 2px solid #333
}
div#beta
{
float: left;
width: 90%;
height: 100%;
margin: 0;
text-align: center
}[/CODE]

Now the total width is equal to 100%, but the text in beta class is uncentered. Any ideas to what is causing this?

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@pcthugFeb 15.2006 — [I]Dave Shea: [/I]Sometimes rounding errors will cause something like 50% + 50% to add up to 100.1%, which ends up breaking layouts in some browsers. Try bumping down the 50% to 49%, or even 49.9%.
Copy linkTweet thisAlerts:
@Gaurav_KhannaFeb 21.2006 — just try to remove the float from the div beta

div#beta

{

width: 90%;

height: 100%;

margin: 0;

text-align: center

}
------------------------


or
------------------------


.alpha

{

float: left;

width: 10%;

height: 100%;

margin: 0;

border-top: none;

border-right: 2px solid #333;

border-bottom: 2px solid #333

}

.beta

{

width: 90%;

height: 100%;

margin: 0;

text-align: center

}


and call beta class in the div
×

Success!

Help @Drew06 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.17,
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,
)...