Jalbkay
asked on
HTML automatic div resizing
G'day All,
I'd like to get a <div> to resize automatically, the same as the background in the following snippet, so that the linkbar div stays at the bottom of the header and doesn't sit halfway down the page as the browser screen narrows. Any and all help greatly appreciated.
.header {
background-image: url(assets/jpgs/header.jpg );
background-repeat:no-repea t;
background-position:center top;
background-attachment:fixe d;
-o-background-size: 80% auto, auto;
-moz-background-size: 80% auto, auto;
-webkit-background-size: 80% auto, auto;
background-size: 80% auto, auto;
}
.linkbar {style: height: 64px;
align: center;
text-align: center;}
I'd like to get a <div> to resize automatically, the same as the background in the following snippet, so that the linkbar div stays at the bottom of the header and doesn't sit halfway down the page as the browser screen narrows. Any and all help greatly appreciated.
.header {
background-image: url(assets/jpgs/header.jpg
background-repeat:no-repea
background-position:center
background-attachment:fixe
-o-background-size: 80% auto, auto;
-moz-background-size: 80% auto, auto;
-webkit-background-size: 80% auto, auto;
background-size: 80% auto, auto;
}
.linkbar {style: height: 64px;
align: center;
text-align: center;}
ASKER
Hi Amish,
Sure: http://renegadewing.com/renegade_wing.html
Just resize your browser and you will see what I mean.
Cheers
Chris
Sure: http://renegadewing.com/renegade_wing.html
Just resize your browser and you will see what I mean.
Cheers
Chris
Hi Chris,
There are two options I can think of here. First one is to have a fixed size background such as is on the index page of the site. Alternatively if you want the background image to shrink when the window is resized use embedded <div> tags and set the background in the parent <div>.
Example:
That will keep the linkbar 10px above the bottom of the background image. If you also want to look at resizing those link images on a browser resize then I would recommend looking into jQuery.
Let me know if you need a bit more clarification on any of this.
Kind regards,
Amish.
There are two options I can think of here. First one is to have a fixed size background such as is on the index page of the site. Alternatively if you want the background image to shrink when the window is resized use embedded <div> tags and set the background in the parent <div>.
Example:
<style>
.header {
position: relative;
background-image: url(assets/jpgs/header.jpg);
background-repeat:no-repeat;
background-position:center top;
background-attachment:fixed;
-o-background-size: 80% auto, auto;
-moz-background-size: 80% auto, auto;
-webkit-background-size: 80% auto, auto;
background-size: 80% auto, auto;
}
.linkbar{
position: absolute;
bottom: 10px;
height: 64px;
align: center;
text-align: center;
}
</style>
<body>
<div class="header">
<div class="linkbar">
</div>
</div>
</body>
That will keep the linkbar 10px above the bottom of the background image. If you also want to look at resizing those link images on a browser resize then I would recommend looking into jQuery.
Let me know if you need a bit more clarification on any of this.
Kind regards,
Amish.
ASKER
Hi Amish...
Not really the desired result:
http://renegadewing.com/css_test.html
The header div doesn't resize in any way and the linkbar is unuseable as the header div has no sizing. Is there not a way to make the div resize with the background?
Not really the desired result:
http://renegadewing.com/css_test.html
The header div doesn't resize in any way and the linkbar is unuseable as the header div has no sizing. Is there not a way to make the div resize with the background?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Once I was able to make it clear what I was trying to do Amish nailed it! And I've learned something new to boot :)
Glad I could help :)
Have you got an example of the page I can look at to get a clearer image of what you want it to do?
Kind regards,
Amish.