CSS & Web Design Forum  

Welcome to the CSS & Web Design Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
WM Media Banner

Supporters
Pos Software - POS hardware and Software to track, control and manage your inventory.
Web Templates - BoxedArt is the most reliable source for unlimited template downloads.

Directory Submission
WL Marketing - Your #1 source for building links

Go Back   CSS & Web Design Forum > Web Design > CSS
Reply
 
Thread Tools Search this Thread Display Modes
(#1)
Old
Mike
Guest
 
Default how to use javascript in CSS... - 10-03-2008, 09:00 PM

Hi. I've got a page in which the content is within a DIV centered on
the screen. I'm trying to figure out how to deal with the Firefox
issue in which the content shifts to the left whenever the scrollbar
appears.

I found the following bit of code online:

----
var viewport;
var viewport2;

function getViewport(){
// Get viewport width in FF2, Safari 1+, or IE6 w doctype:
if (document.documentElement &&
document.documentElement.clientWidth) {
viewport = document.documentElement.clientWidth;
viewport2 = window.innerWidth; }

// Get viewport width in FF2, Safari 1+, IE5-5.5, or IE6 without a
doctype:
else if (document.body.clientWidth) {
viewport = document.body.clientWidth;
viewport2 = window.innerWidth; }
}
----

I played around with it, and found that "viewport" will give me the
width of the viewing area minus the width of the scrollbar;
"viewport2" gives the width of the viewing area plus the scrollbar.

I'm trying to figure out how to use that information in my CSS
stylesheet. Here's what I'm currently using to position the main
container:

----
#main
{ width: 800px;
margin-left: auto;
margin-right: auto;
}
----

Any thoughts on how to merge the javascript and CSS...?

Thanks much for any help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Hosting at Triple.com
vBulletin Skin developed by: vBStyles.com

Printing Company  Link Building Services