•
•
•
•
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
![]() |
•
•
Join Date: Jun 2007
Location: Woodstock, New Brunswick, Canada
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
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:
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.
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Why do people wish for tableless with CSS? (HTML and CSS)
- CSS positioning problems (HTML and CSS)
- CSS Column height issue (HTML and CSS)
- Selectively Printing only Certain Divs (javascript/css question) (JavaScript / DHTML / AJAX)
- CSS - strech a background image? (Site Layout and Usability)
Other Threads in the HTML and CSS Forum
- Previous Thread: Submit
- Next Thread: mac vs windows; help to resolve the problem



Linear Mode