/    Sign up×
Community /Pin to ProfileBookmark

width 100% goes off screen?

how come when i set the width for my content box to 100%, it goes off the screen on the right?

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@_eric_meMar 23.2008 — how come when i set the width for my content box to 100%, it goes off the screen on the right?[/QUOTE]

What browser(s) are you seeing this issue in? Can you paste in the code as there could be a few different reasons?
Copy linkTweet thisAlerts:
@WebJoelMar 23.2008 — Probably there is something being added to the width, like another DIV to it's left? Is there a left-hand navigation that is not being included in the container "#content"? width:100%; means "100% as wide as the screen", which is not the same thing as "width:auto". Width:[I]auto[/I]; would merely occupy whatever available space is left and is more suited for fluid layout.

So a container that holds a left-hand navigation of, say, 200px wide, and has "#content" to it's right that is "width:100%;", [I]that[/I] is "100% the [I]width of your viewscreen[/I] plus margins plus padding plus [I]width of left-hand DIV[/I].

Would need to see your code, but the description seems to suggest that this is what you have going on. ?
Copy linkTweet thisAlerts:
@mr_newbieauthorMar 24.2008 — ive changed 100% to auto but it doesnt help. heres my code:

[CODE]#content
{margin: 0px auto;
width: auto;
height: 500px;
background-color: #FFFFFF;
color: #000000;
font-size: 16px;}
[/CODE]


im using IE6 and it looks fine locally, its just when i view it on the internet that it goes off the screen. it views fine live with firefox though. could it be an ie6 bug?
Copy linkTweet thisAlerts:
@CentauriMar 24.2008 — Get rid of the "auto" in the margin property - IE will have problems with auto side margins if no width is set or there is no room for side margins (as is the case with 100% width).

As "auto" is the default value for width, it also does not need to be specified.
Copy linkTweet thisAlerts:
@mr_newbieauthorMar 25.2008 — i removed the auto stuff, but it still goes off the page on the right in IE6 when viewed live.

its fine locally in IE6 and it even looks fine in mozilla firefox live.

im out of ideas!
Copy linkTweet thisAlerts:
@CentauriMar 25.2008 — Will need to see the live site to help much further.
×

Success!

Help @mr_newbie 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...