CSS - IE don't get the margin-bottom from the last div - css

I've a container, where i have some divs : header, content, footer (as a standart application).
this is the structure :
<body>
<div>
<div id="ROOT" >
<div id="ROOT_0" >
Header
</div>
<div id="ROOT_1" >
Content
</div>
<div id="ROOT_2" >
Footer
</div>
</div>
</div>
</body>
The actual CSS :
html {height:101%;}
body {background:#999999;}
#ROOT{ background-color:#333333; width:980px; margin-left:auto; margin-right:auto; overflow:auto;}
#ROOT_0{background-color:#FF9933; width:970px; text-align:center; float:left; margin-top:5px; margin-left:5px; margin-right:5px; margin-bottom:5px;}
#ROOT_1{width:980px; text-align:center; float:left; background-image:url(../img/sfondofc.jpg);}
#ROOT_2{background-color:#FF9933; width:970px; padding-top:5px; padding-bottom:5px; text-align:center; float:left; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px; font-weight:bold; font-size:13px;}
background-color:#FF9933; width:970px; padding-top:5px; padding-bottom:5px; text-align:center; float:left; margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px; font-weight:bold; font-size:13px;
unfortunatly, on IE (6) i can't see the margin-bottom:5px; in the end, where i have the footer. Which propriety i need to change? Cheers

why did you set the height property of html to 101 percent ?

Related

1 image and two elements floating right next to it

I am trying to have 1 image and two elements floating right next to it (and the two elements on two separate lines). I tried working with display:inline-block so that each of the two elements comes on a separate line, but no luck. Also, the "brand" should be on top of the "model", thus first Mercedes and second W126. Is it possible to achieve this?
Fiddle here... Fiddle
HTML:
<div class="car"><img alt="" src=
"http://placehold.it/50x50&text=CAR"></div>
<div class="brand">
Mercedes
</div>
<div class="model">
W126
</div>
CSS:
.car img {
max-width:100%;
max-height:100%;
margin:0;
display:block;
}
.brand {
font-size:16px;
color:#333333;
font-family:'Droid Serif';
font-weight:bold;
padding-left:10px;
padding-bottom:0px;
padding-top:5px;
float:left;
margin-left:2px;
margin-right:2px;
margin-top:2px;
display:inline-block;
}
.model {
font-size:12px;
color:#5A5A5A;
font-family:'Droid Serif';
font-style:normal;
margin-left:2px;
margin-right:2px;
margin-bottom:2px;
padding-left:10px;
float:left;
display:inline-block;
}
It's easy if you change the HTML & CSS a bit:
.car {
display:inline-block;
}
.car img {
max-width:100%;
max-height:100%;
margin:0;
display:inline-block;
vertical-align:middle;
}
.car .makeAndModel {
margin:0 0 0 5px;
font-family:'Droid Serif';
display:inline-block;
vertical-align:middle;
}
.brand {
font-size:16px;
color:#333333;
font-weight:bold;
display:block;
}
.model {
font-size:12px;
color:#5A5A5A;
font-style:normal;
display:block;
}
<div class="car">
<img alt="" src="http://placehold.it/50x50&text=CAR" />
<div class="makeAndModel">
<div class="brand">
Mercedes
</div>
<div class="model">
W126
</div>
</div>
</div>
You can use some floats instead:
.car img {
max-width:100%;
max-height:100%;
margin:0;
float:left;
}
.brand {
font-size:16px;
color:#333333;
font-family:'Droid Serif';
font-weight:bold;
padding-left:10px;
padding-bottom:0px;
padding-top:5px;
margin-left:52px;
margin-right:2px;
margin-top:2px;
}
.model {
font-size:12px;
color:#5A5A5A;
font-family:'Droid Serif';
font-style:normal;
margin-left:2px;
margin-right:2px;
margin-bottom:2px;
padding-left:10px;
float:left;
}
<div class="car">
<img alt="" src="http://placehold.it/50x50&text=CAR">
</div>
<div class="brand">Mercedes</div>
<div class="model">W126</div>
Note that .brand has no float which allows the W126 to be pushed to the line below it, and the margin has been increased to space it properly.

CSS - Can't send div to the right?

I'm trying to send a div block to the right side of my page with a float:right; but it doesn't work.
HTML :
<div id="footer_div">
<footer>
<div class="copyrights">
<a href="contact.html" style="
color:#8C8C8C;
font-weight:bold;
text-decoration:none;
font-size:xx-small;
"><center>Site © 2013</center></a>
</div>
<div class="footer_links">
<a href="cgu.html" style="
color:#FFF;
font-weight:bold;
text-decoration:none;
font-size:xx-small;
">Conditions d'utilisation</a>
<a href="about.html" style="
color:#FFF;
font-weight:bold;
text-decoration:none;
font-size:xx-small;
">A propos</a>
<a href="help.html" style="
color:#FFF;
font-weight:bold;
text-decoration:none;
font-size:xx-small;
">Aide</a>
<a href="contact.html" style="
color:#FFF;
font-weight:bold;
text-decoration:none;
font-size:xx-small;
">Contact</a>
</div>
</footer>
</div>
CSS :
footer
{
position:fixed;
bottom:0;
height:45px;
width:100%;
background:url(Templates/footer1.png) repeat-x bottom;
}
.copyrights
{
float:left;
position:fixed;
bottom:17.5px;
text-decoration:none;
margin-left:8px;
}
.footer_links
{
float:right;
height:20px;
width:240px;
position:fixed;
bottom:17.5px;
text-decoration:none;
border:0px solid;
}
Any idea how I can solve that ?
I want the .footer_links to go to the right side of my page.
Thanks !
Chris.
Take off the position fixed you have specified on the .footer-links class.
See this jsFiddle example.
http://jsfiddle.net/wCMqY/6/
footer
{
position:fixed;
bottom:0;
height:45px;
width:100%;
background:red;
}
.copyrights
{
float:left;
bottom:17.5px;
text-decoration:none;
margin-left:8px;
}
.footer_links
{
float:right;
height:20px;
width:240px;
text-decoration:none;
border:0px solid;
background:green;
}
.clear {
clear:both;
}
It's the position fixed that's causing you problems

trouble with box model

I can't figure out how to set up the box model for my layout.
The "[container|x]" elements you see are placeholders, which are later replaced by php.
Here is a sketch of how it should look like:
I tried to google it and search here on stack overflow and of course I did find a lot about box models and problems with it, but nothing helped me here.
This is what I already have:
html:
<div class='headerimage'>
[container|1]
</div>
<div class='mainwrapper'>
<div class='femininHead'>
[container|2]
</div>
<div class='lineH1'> </div>
<div class='feminin'>
<div class='femininSub1'>
[container|3]
</div>
<div class='lineV1'> </div>
<div class='femininSub2'>
[container|4]
</div>
<div class='lineV2'> </div>
<div class='femininSub3'>
[container|5]
</div>
</div>
<div style='clear:both;'></div>
<div class='maskulinHead'>
[container|6]
</div>
<div class='lineH2'> </div>
<div='maskulin'>
<div class='maskulinSub1'>
[container|7]
</div>
<div class='lineV3'> </div>
<div class='shopButton'>
[container|8]
</div>
</div>
<div style='clear:both;'></div>
<div class='unisexHead'>
[container|9]
</div>
<div class='lineH3'> </div>
<div class='unisex'>
<div class='unisexSub1'>
[container|10]
</div>
<div class='lineV4'> </div>
<div class='unisexSub2'>
[container|11]
</div>
<div class='lineV5'> </div>
<div class='unisexSub3'>
[container|12]
</div>
</div>
</div>
css:
.headerimage {
position:absolute;
left:0px;right:0px;
background-color:#000000;
height:367px;
}
.mainwrapper{
position:relative;
top:367px;
}
.femininHead {
position:relative;
width:800px;
height:87px;
top:50px;
}
.femininHead .image1_headline{
line-height:30px;
font-size:24px;
position:relative;
}
.feminin {
position:relative;
}
.lineH1{
background-image:url(/img/tempdyn/streifenlinie_horizontal.png);
width:800px;
height:1px;
background-color:#000000;
position:relative;
bottom:2px;
}
.femininSub1 {
position:relative;
width:266px;
height:125px;
float:left;
}
.lineV1{
background-image:url(/img/tempdyn/streifenlinie_vertikal.png);
background-repeat:repeat-y;
background-position:right top;
float:left;
height:128px;
width:1px;
background-color:#000000;
position:relative;
}
.femininSub2 {
position:relative;
width:266px;
height:125px;
float:left;
}
.lineV2{
background-image:url(/img/tempdyn/streifenlinie_vertikal.png);
background-repeat:repeat-y;
background-position:right top;
float:left;
height:128px;
width:1px;
background-color:#000000;
position:relative;
}
.femininSub3{
width:266px;
height:125px;
position:relative;
float:left;
position:relative;
}
.maskulinHead {
position:relative;
width:800px;
height:87px;
top:127px;
}
.maskulinHead .image2_headline{
line-height:36px;
font-size:36px;
right:300px;
}
.lineH2{
background-image:url(/img/tempdyn/streifenlinie_horizontal.png);
width:800px;
height:1px;
background-color:#000000;
position:relative;
top:133px;
}
.maskulin {
position:relative;
}
.maskulinSub1 {
position:relative;
width:266px;
height:125px;
float:left;
position:relative;
}
.lineV3{
background-image:url(/img/tempdyn/streifenlinie_vertikal.png);
background-repeat:repeat-y;
background-position:right top;
float:left;
position:relative;
height:128px;
width:1px;
}
.shopButton {
width:536px;
height:218px;
float:left;
position:relative;
}
.unisexHead{
width:259px;
height:125px;
position:relative;
line-height:36px;
font-size:36px;
}
.unisexHead .image3_headline{
line-height:36px;
font-size:36px;
}
.lineH3{
background-image:url(/img/tempdyn/streifenlinie_horizontal.png);
width:800px;
height:1px;
background-color:#000000;
position:relative;
top:594px;
}
.unisex {
position:relative;
}
.unisexSub1
position:relative;
width:266px;
height:125px;
float:left;
}
.lineV4{
background-image:url(/img/tempdyn/streifenlinie_vertikal.png);
background-repeat:repeat-y;
background-position:right top;
float:left;
background-color:#000000;
position:relative;
height:128px;
width:1px;
}
.unisexSub2 {
position:relative;
width:266px;
height:125px;
float:left;
}
.lineV5{
background-image:url(/img/tempdyn/streifenlinie_vertikal.png);
background-repeat:repeat-y;
background-position:right top;
float:left;
background-color:#000000;
position:relative;
height:128px;
width:1px;
}
.unisexSub3{
width:266px;
height:125px;
position:relative;
float:left;
}
Thanks in advance :)
can't see why box-model can help you with this. maybe you are looking for FlexBox! Or go classic and use display:inline-block for the nested boxes(3,4,5,7,8,10,11,12) and all others just row divs.
But don't use floats any more!
Check out this simplified solution on JSBin.
The basic idea is to wrap all the items except the 1st box in a containing wrapper .wrap. A horizontal margin of auto along with a fixed width will center it in the page. Within that, you have your side-by-side boxes float left and give them fixed widths. The div below them needs to clear the float.
Hope the example is helpful.

maintain aspect ratio on browser resize

The wrapper container css is width:auto; max-height:70%;
I want the divs to maintain their aspect ratio when browser window height changes.
jfiddle: http://jsfiddle.net/7JNuU/
HTML
<div id="feedwrapper">
<!--FULL group-->
<div id="tile">
<div id="fullcell">1</div>
</div>
<!--FULL group-->
<!--4up group-->
<div id="tile">
<div id="solocell">1</div>
<div id="solocell">2</div>
<div id="solocell">3</div>
<div id="solocell">4</div>
</div>
<!--4up group-->
<!--2top group-->
<div id="tile">
<div id="solocell">1</div>
<div id="solocell">2</div>
<div id="cell2xbot">3</div>
</div>
<!--2top group-->
CSS
#feedwrapper{
width:auto;
max-height:70%;
top:80px;
bottom:60px;
margin-bottom:80px;
left:300px;
position:absolute;
background-color:#FFF;
white-space:nowrap;
display:block;
}
#tile{ position:relative; border:none; padding:0px; min-width:640px; height:100%; margin:0px 2px 2px 0px; background-color:#CC6; float:left;}
#fullcell{width:100%; height:100%; background-color:#F99; display:block;}
#solocell{ width:50%; height:50%; background-color:#36C; display:block; float:left;}
#cell2xbot{ width:100%; height:50%; background-color:#C93; display:block; float:left;}
#cell2xtop{ width:100%; height:50%; background-color:#C66; display:block; float:left;}
#cell2yleft{ width:50%; height:100%; background-color:#99C; display:block; float:left;}
#cell2yright{ width:50%; height:100%; background-color:#FC6; display:block; float:right;}
The page I'm working on is: http://www.jordache.com/connect.php
The grid uses squares and rectangles.
50%x50% squares, 100% squares, 50%x/100%y rect, and 100%x/50%y rect.
There must be a simpler way.... grrrrr... help!

How to make rounded corner cut-out using CSS?

I'd like to make something that looks like the below image using CSS:
I'm at a total loss on how to do that. Might someone help?
This can be done using two elements or one element and a pseudo-element:
HTML:
<div></div>
CSS:
div { position:relative; background-color:#333; padding:20px;
margin:20px; float:left; }
div:before { content:""; display:block; padding:5px; background-color:#f60;
border:2px solid white; position: absolute; top:-2px;
right:-2px;}​
http://jsfiddle.net/Vv6Eb/
Update:
With border-top-right-radius:
http://jsfiddle.net/Vv6Eb/1/
Or, border-bottom-left-radius:
http://jsfiddle.net/Vv6Eb/4/
<div id="page">
<div id="up">
</div>
<div id="logo">
<div id="logobody"></div>
</div>
<div id="down">
</div>
</div>​
#page{
margin:30px auto;
width:500px;
height:auto;
border-radius:10px;
border:2px red thin;
background:white;
overflow:hidden;
}
#logo{
float:right;
width:100px;
height:70px;
border-radius:10px;
background:white;
margin-top:-70px;
margin-right:10px;
}
#up{
width:80%;
height:60px;
border-radius-top:10px;
background:gray;
}
#down{
margin-top:-0px;
margin-right:-10px;
width:100%;
height:60px;
border-radius: 0px 10px 10px 10px;
background:gray;
}
#logobody{
border:2px blue solid;
margin :auto;
width:85px;
height:50px;
margin-top:10px;
margin-right:0px;
border-radius:7px;
}
​
jsFiddle
Use float..http://www.w3schools.com/css/css_float.asp
<div style="background-color:#000; height:500px; width:500px; margin-bottom:10px;">
<div style="background-color:#FFF; float:right; height:100px; width:100px; margin-right:10px; margin-top:10px;"></div>
</div>
<div style="background-color:#000; height:500px; width:500px; position:relative;">
<div style="background-color:#FFF; position:absolute; right:0px; height:100px; width:100px; margin-right:10px; margin-top:10px;"></div>
</div>​
Inline styles is not advisable so might wanna write the styles in your stylesheet file. Using float makes the texts wraps the div tag. The seconds code stacks

Resources