User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 402,962 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,682 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1000 | Replies: 1
Reply
Join Date: Jun 2007
Location: Woodstock, New Brunswick, Canada
Posts: 1
Reputation: DixieDesigner is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
DixieDesigner's Avatar
DixieDesigner DixieDesigner is offline Offline
Newbie Poster

CSS Positioning & Width/Height Issue

  #1  
Jun 14th, 2007
I'm trying to teach myself CSS. The only thing I've used it for before was for text formatting but now I'm trying my hand at positioning the elements through CSS.

The issue I've run into is that I have an element that is offset by so many pixels to the left, but I want it to stretch to the full browser window's width. Unfortunately having and offset AND height="100%" sets the 100% width off but that many pixels so you have to scroll to the side to see all of the element. The same this is happening with a vertical element.

I need the design to adapt to different resolutions/window sizes without unnecessary scrolling.

The test site (the design elements are also rough, as you can tell by looking at the images) can be found at http://freeplayenergy.com/NewSiteTest/test.html

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 2,537
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 111
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: CSS Positioning & Width/Height Issue

  #2  
Jun 19th, 2007
There are several causes to this problem

Mozilla browsers consider any margins, borders, and padding to be OUTSIDE the declared dimensions and positions of a box object. This includes floats.

IE consider any margins, borders, and padding to be INSIDE the declared dimensions and positions of a box object. This includes floats.

So you have to design your page in such a way that this discrepancy doesn't matter. The trick is to nest some stuff.

First the body tag has different defaults in different browsers. If the box object surroundings are getting in your way, apply a style such as:

.nosurr {margin: none; border: none; padding: none;}


Apply it to the body, and to the image itself if necessary.

You can't simultaneously stretch an image to both the browser window width and height without changing the aspect-ratio on sime computers. This has the fun-house mirror effect on the image.

I prefer to center an image horizontally instead.

There is no value which sets the object to the height of the browser window. The window is considered to be infinitely high. Height: 100%; always takes the height of its container.
Daylight-saving time uses more gasoline
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 7:11 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC