Add margin around image in list - html

I have been able to show an image in a list with a gradient here :
http://stackoverflow.com/questions/23747548/css-list-not-working-if-in-hex/23749271#23749271
I now need to add a margin around the image. I can't seem to find the CSS to do this.
MrWarby
Code from the default.css file that controls the list: (it is a bigcommerce site)
.SubCategoryList li a,.topNav .CategoryList li a,.homeNav #SideCategoryList li a, .MenuList li a{
/* background: #6daad3; Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url('http://www.clker.com/cliparts/8/a/3/1/1197107206400036309metalmarious_Laptop.svg.med.png') no-repeat ,-moz-linear-gradient(top, #6daad3 0%, #396b9e 100%); /* FF3.6+ */
background: url('http://www.clker.com/cliparts/8/a/3/1/1197107206400036309metalmarious_Laptop.svg.med.png') no-repeat ,-webkit-gradient(linear, left top, left bottom, color-stop(0%,#6daad3), color-stop(100%,#396b9e)); /* Chrome,Safari4+ */
background: url('http://www.clker.com/cliparts/8/a/3/1/1197107206400036309metalmarious_Laptop.svg.med.png') no-repeat ,-webkit-linear-gradient(top, #6daad3 0%,#396b9e 100%); /* Chrome10+,Safari5.1+ */
background: url('http://www.clker.com/cliparts/8/a/3/1/1197107206400036309metalmarious_Laptop.svg.med.png') no-repeat ,-o-linear-gradient(top, #6daad3 0%,#396b9e 100%); /* Opera 11.10+ */
background: url('http://www.clker.com/cliparts/8/a/3/1/1197107206400036309metalmarious_Laptop.svg.med.png') no-repeat ,-ms-linear-gradient(top, #6daad3 0%,#396b9e 100%); /* IE10+ */
background: url('http://www.clker.com/cliparts/8/a/3/1/1197107206400036309metalmarious_Laptop.svg.med.png') no-repeat ,linear-gradient(to bottom, #6daad3 0%,#396b9e 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6daad3', endColorstr='#396b9e',GradientType=0 ); /* IE6-8 */
background-size: 80px 80px;
/* background-image:url('http://static.dezeen.com/uploads/2013/03/dezeen_Sergio-concept-car-by-Pininfarina_ss_4.jpg'); */
}
.SubCategoryList li,.topNav .CategoryList li,.homeNav #SideCategoryList li, .MenuList li{
position:relative
}
.SubCategoryList li a:before,.topNav .CategoryList li a:before,.homeNav #SideCategoryList li a:before, .MenuList li a:before {
font-family:'FontAwesome-webfont';
font-weight:normal;
font-style:normal;
content:"\f054";
position:absolute;
top:50%;
right:10px;
z-index:1;
font-size:14px;
color:#ccc;
margin:-8px 10px 0 0
}
existing list
!(https://www.dropbox.com/s/bbu4xkc2h0m26fl/Screen%20Shot%202014-05-20%20at%2014.52.42.png)
required look
!(https://www.dropbox.com/s/9vbr2ap26wbdgfo/Screen%20Shot%202014-05-20%20at%2014.52.27.png)

Try this code:
img {
margin-left: 20px;
}

Related

Add padding to table (Maintain cell collapsed)

I'm making a table with a border between each row, I've been trying to edit the table so the row borders don't touch the outer border of the table and I can't figure it out for the life of me. I feel like there's probably a solution that I have completely overlooked.
What I'd like it to look like:
What it looks like at the moment:
IF the borders are set to TD inner elements
tr td:first-child {
padding-left:25px;
}
tr td:last-child {
padding-right:25px;
}
Otherwise a nice way to do it would be to use a transparent table inside a
gray DIV that has the padding you need
.tableContainer{
padding:15px;
position:relative;
margin:0 auto;
background:#353033;
border:1px solid #000;
box-shadow:0 5px 15px rgba(0,0,0,0.3);
}
table{
color:#B3B3B3;
table-layout:fixed;
border-collapse:collapse;
width:100%;
}
td, th{
text-align:left;
padding:5px 0;
border-bottom: 1px solid #000;
}
/* --------------------- */
html, body{
height:100%;
}
body{
font: 16px/1 sans-serif;
color: #fff;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#6da5ce+0,9c7bac+50,ec8e99+100 */
background: #6da5ce; /* Old browsers */
background: -moz-linear-gradient(45deg, #6da5ce 0%, #9c7bac 50%, #ec8e99 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#6da5ce), color-stop(50%,#9c7bac), color-stop(100%,#ec8e99)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* IE10+ */
background: linear-gradient(45deg, #6da5ce 0%,#9c7bac 50%,#ec8e99 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6da5ce', endColorstr='#ec8e99',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
<div class="tableContainer">
<table>
<tr>
<th>Title</th>
<th>Title</th>
</tr>
<tr>
<td>Text goes here</td>
<td>and here also</td>
</tr>
</table>
</div>
.tableContainer {
padding: 15px 0px;}
td, th {
padding: 5px 10px;}

The background images of the div is not being displayed. What can I do?

I have entered the HTML and CSS codes below. What the problem, is that the background image fails to appear. Please do help. Thanks in advance.
.parallax-1 {
height: 200px;
width: 100%;
background: linear-gradient(to bottom, #000 -10%, transparent 30%),
linear-gradient(to top, #000 -10%%, transparent 30%),
url('http://lorempixel.com/400/200');
background-size: cover;
}
.parallax {
width: 100%;
}
.descript {
background: #f2f2f2;
font-family: 'open sans', sans-serif;
font-style: italic;
font-weight: 200;
font-size: 0.7em;
padding: 5px 10px;
}
<!DOCTYLE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,800italic,300,400' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="parallax-1 parallax">
<div class="descript-parallax">
<span>Description for the image</span><br>
<span class="photo-descript">Copyright someone</span>
</div>
</div>
</body>
</html>
Update:
I removed linear gradient ans tried, as advised in some code given in the answers. How can I add them? Also, why is this problem coming only in the top browser Chrome ( latest version )? Some browsers are displaying it, according to the comments below.
your css is mixed up.
use like this
body {
background: #6cab26;
background-image: url(IMAGE_URL); /* fallback */
background-image: url(IMAGE_URL), -webkit-gradient(linear, left top, left bottom, from(#6cab26), to(#6ceb86)); /* Saf4+, Chrome */
background-image: url(IMAGE_URL), -webkit-linear-gradient(top, #6cab26, #6ceb86); /* Chrome 10+, Saf5.1+ */
background-image: url(IMAGE_URL), -moz-linear-gradient(top, #6cab26, #6ceb86); /* FF3.6+ */
background-image: url(IMAGE_URL), -o-linear-gradient(top, #6cab26, #6ceb86); /* Opera 11.10+ */
background-image: url(IMAGE_URL), linear-gradient(to bottom, #6cab26, #6ceb86); /* W3C */
}
in order to get background image with gardient.
(How do I combine a background-image and CSS3 gradient on the same element?)
It's working in Firefox, Chrome, ... but You need define background for each -moz- for FF, -webkit- for chrome and so on.
There is example :
.parallax-1 {
height: 200px;
width: 100%;
border:solid 1px gray;
background: -moz-linear-gradient(top, rgba(0,0,0,0.65) -10%, rgba(0,0,0,0) 30%),url('http://lorempixel.com/400/200');
background: -webkit-gradient(linear, left top, left bottom, color-stop(-10%,rgba(0,0,0,0.65)), color-stop(30%,rgba(0,0,0,0))),url('http://lorempixel.com/400/200');
background: -webkit-linear-gradient(top, rgba(0,0,0,0.65) -10%,rgba(0,0,0,0) 30%),url('http://lorempixel.com/400/200');
background: -o-linear-gradient(top, rgba(0,0,0,0.65) -10%,rgba(0,0,0,0) 30%),url('http://lorempixel.com/400/200');
background: -ms-linear-gradient(top, rgba(0,0,0,0.65) -10%,rgba(0,0,0,0) 30%),url('http://lorempixel.com/400/200');
background: linear-gradient(to bottom, rgba(0,0,0,0.65) -10%,rgba(0,0,0,0) 30%),url('http://lorempixel.com/400/200');
background-size: cover;
}
.parallax {
width: 100%;
}
.descript {
background: #f2f2f2;
font-family: 'open sans', sans-serif;
font-style: italic;
font-weight: 200;
font-size: 0.7em;
padding: 5px 10px;
}
<div class="parallax-1 parallax">
<div class="descript-parallax">
<span>Description for the image</span><br>
<span class="photo-descript">Copyright someone</span>
</div>
</div>
Of course, for .parallax You can add color:white or some other color, because Your gradient background, black color for text is little hard to see.

Webpage's width is setting to 980px instead of the width of the window. Mobile site

I've been working on a webpage for the last few weeks and I have the desktop version complete. Currently I'm working on a stylesheet for the mobile site. But I've run into a problem where the content div will not size to the width of the screen. I've checked all width tags and max width tags all are set to 100% instead of an exact screen size. I've also used js to get the window size and on my test device it's 540px; but the div tag is sizing to 980px. I have a reset css stylesheet included and I made sure it doesn't affect the size as well. I've noticed using position:fixed makes it the right size but then it doesn't scroll. here's the style sheet. and html. Sorry if my code is poor. I'm an application programmer by trade, not a web designer. Any constructive criticism would be appreciated as well.
http://jsfiddle.net/justinclev/ma63f3vo/
html, body { height:100%; width:100%;}
body {
background-color:#131720;
font-family: 'helvetica';
text-align:justify;
text-justify:inter-word;
}
.Header {
z-index:95;
position:relative;
width:100%;
height: 35px;
background-color: #039de3;
/*
background: #5078CC; /* Old browsers
background: -moz-linear-gradient(top, #D93F3F 0%, #FF4040 90%, #4C2020 100%); /* FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#D93F3F), color-stop(90%,#FF4040), color-stop(100%,#4C2020)); /* Chrome,Safari4+
background: -webkit-linear-gradient(top, #D93F3F 0%,#FF4040 90%,#4C2020 100%); /* Chrome10+,Safari5.1+
background: -o-linear-gradient(top, #D93F3F 0%,#FF4040 90%,#4C2020 100%); /* Opera 11.10+
background: -ms-linear-gradient(top, #D93F3F 0%,#FF4040 90%,#4C2020 100%); /* IE10+
background: linear-gradient(to bottom, #D93F3F 0%,#FF4040 90%,#4C2020 100%); /* W3C
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D93F3F', endColorstr='#4C2020',GradientType=0 ); /* IE6-9 */
}
.Header .Title {
float:left;
width:auto;
margin-left:1%;;
position: absolute;
bottom:5px;
font-size: 20px;
color: white;
}
.Container {
position:fixed;
height:auto;
margin-top:65px;
margin-bottom:70px;
}
.Content {
overflow:auto;
min-height: 100%;
background-color:white;
box-shadow: 15px 0 21px -10px black, -15px 0 21px -10px black;
}
.linkButton {
font-family: 'Roboto', cursive;
background: none;
border: none;
font-size: 16px;
color: #ED5555;
text-decoration: none;
cursor: pointer;
}
.HomePageText {
margin:1%;
width:60%;
float:left;
font-size:8px;
}
/*
*
*
* Header
*
*/
.heading {
font-family: 'Roboto', sans-serif;
width: 100%; /* Spans the width of the page */
height: 60px;
z-index:98;
position: fixed;
top: 0px;
background-color:#131720;
/*
background: #5078CC; /* Old browsers *
background: -moz-linear-gradient(top, #063497 0%, #5078CC 90%, #022162 100%); /* FF3.6+ *
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#063497), color-stop(90%,#5078CC), color-stop(100%,#022162)); /* Chrome,Safari4+ *
background: -webkit-linear-gradient(top, #063497 0%,#5078CC 90%,#022162 100%); /* Chrome10+,Safari5.1+ *
background: -o-linear-gradient(top, #063497 0%,#5078CC 90%,#022162 100%); /* Opera 11.10+ *
background: -ms-linear-gradient(top, #063497 0%,#5078CC 90%,#022162 100%); /* IE10+ *
background: linear-gradient(to bottom, #063497 0%,#5078CC 90%,#022162 100%); /* W3C /
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#063497', endColorstr='#022162',GradientType=0 ); /* IE6-9 */
}
.BlueBarHeader {
font-family: 'Roboto', sans-serif;
width: 100%; /* Spans the width of the page */
height: 40px;
z-index:98;
position: fixed;
top:25px;
-webkit-box-shadow: 0px 7px 10px 1px rgba(19,23,32, 0.95);
-moz-box-shadow: 0px 7px 10px 1px rgba(19,23,32,0.95);
box-shadow: 0px 7px 10px 1px rgba(19,23,32,0.95);
background-color:#006694;
background: #006694; /* Old browsers */
}
.Logo {
font-size: 24px;
color: white;
position: absolute;
bottom: 10px;
left: 5px;
}
/*Login Style info */
.Login{
position: absolute;
top: 0px;
right:0;
height:25px;
padding-top:5px;
padding-left: 10px;
padding-right:5px;
color: white;
font-size: 15px;
}
.Login a {
font-family: 'Roboto', sans-serif;
font-size: 15px;
color: white;
text-decoration: none;
}
.Login a:hover {
text-decoration:underline;
color: white;
}
#LoginLink {
display: inline-block;
}
/*
* Footer
*
*/
footer{
position:relative;
display:block;
z-index: 99;
width: 100%;
height:50px;
bottom: 0px;
right:0;
padding-top:0px;
color:white;
background-color:#131720;
/*background: #FF4040; /* Old browsers *
background: -moz-linear-gradient(top, #063497 0%, #5078CC 90%, #063497 100%); /* FF3.6+ *
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#063497), color-stop(90%,#5078CC), color-stop(100%,#063497)); /* Chrome,Safari4+ *
background: -webkit-linear-gradient(top, #063497 0%,#5078CC 90%,#063497 100%); /* Chrome10+,Safari5.1+ *
background: -o-linear-gradient(top, #063497 0%,#5078CC 90%,#063497 100%); /* Opera 11.10+ *
background: -ms-linear-gradient(top, #063497 0%,#5078CC 90%,#063497 100%); /* IE10+ *
background: linear-gradient(to bottom, #063497 0%,#5078CC 90%,#063497 100%); /* W3C /
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#063497', endColorstr='#063497',GradientType=0 ); /* IE6-9 */
}
.footer{
display:block;
z-index: 99;
width: 100%;
height:35px;
bottom: 20px;
right:0;
padding-top:10px;
font-family: 'Roboto', sans-serif;
text-align:center;
font-size:20px;
color:white;
background-color:#006694;
}
footer a{
text-decoration:none;
font-style:italic;
color:white;
}
footer a:hover {
text-decoration:underline;
}
Webpage
<?php
include_once '/includes/db_connect.php';
include_once '/includes/functions.php';
sec_session_start();
if (login_check($mysqli) == true) {
$logged = 'in';
} else {
$logged = 'out';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Imagine That</title>
<?php
include_once '/includes/includes.php';
?></head>
<body>
<div class="Content">
<div class="Container">
<div class="Header">
<div class="Title">Welcome to the Imagine That website!</div>
</div>
<div class="HomePageText">
This site is dedicated to furthering my knowledge of coding as well as web design. If you take a look around which I hope you will.
You will notice that I have quite a bit of features in this site that aren't necessary and some that may just seem obsurd for a digital Portfolio.
Well before you leave thinking I've gone mad and don't know what I'm doing. Allow me to explain the method to my madness, because trust me there is one.
This site has two purposes. The first is to be a digital portfolio displaying my knowledge of code and different projects I have created.
The second is to be a playground for my imagination to come up with new and cool things. To keep it simple this is a digital porfolio displaying all the things that I have learned about web design and coding.
Some of these features can only be accessed by creating a account, Now I know what your thinking. Why should I create a account to such a small website for one guy that serves no purpose for me. Well, To be frank this site does serve a purpose to not only I, but also the new developer looking for source code on odd projects. The projects I post on here will include either their full source code or small fragments for the complicated parts of the program. I will go over a bit of it to teach beginners how to create and do the things I have created already.
So again bare with me and create an account. It's easy and won't take you much time. After that feel free to look around and explore my creation.
</div>
<div style="width:37%; height:100%; float:right;">
<img style="width:95%; height:auto;margin:0 auto; margin-top: 15px;" src="Photos/307470_2505425680003_1303200128_n.jpg" />
</div>
</div>
</div>
<?php
include_once 'Footer.php';
?>
</body>
</html>
Add this to your HTML page's head
<meta name="viewport" content="width=device-width, initial-scale=1.0">

Why doesn't work border-radius in IE9 but in IE10 or Chrome?

I have a problem only with IE9, the reason... border-radius only in one div not working but in others div's works perfectly.
IE9
IE10, Chrome, FF
Html
<article id="main-login">
<div class="radius-10 shadow"></div>
<div id="area-login" class="radius-10 shadow">
<h2>Iniciar sesión</h2>
<p><input id="user-user" class="radius-10" type="text" placeholder="Usuario" required/></p>
<p><input id="user-pass" class="radius-10" type="password" placeholder="Contraseña" required/></p>
<p><input id="do-login" type="submit" value=""/></p>
<small>Si aún no eres usuario</small>
<medium>Registrate aquí</medium>
</div>
</article>
CSS
.radius-10 {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.shadow {
-webkit-box-shadow: 0px 1px 12px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 1px 12px rgba(50, 50, 50, 0.75);
box-shadow: 0px 1px 12px rgba(50, 50, 50, 0.75);
}
#main-login {
margin-top: 25px;
width: 100%;
}
#main-login div {
display: inline-block;
height: 170px;
vertical-align: top;
}
#main-login > div:first-child {
background: url(../media/images/medicos.jpg) no-repeat;
background-attachment:fixed;
margin-right: 20px;
overflow: hidden;
width: 73%;
}
#area-login {
background: rgb(255,255,255); /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSI4MiUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZTVlY2VmIiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L2xpbmVhckdyYWRpZW50PgogIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+Cjwvc3ZnPg==);
background: -moz-linear-gradient(top, rgba(255,255,255,1) 82%, rgba(229,236,239,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(82%,rgba(255,255,255,1)), color-stop(100%,rgba(229,236,239,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,255,255,1) 82%,rgba(229,236,239,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5ecef',GradientType=0 ); /* IE6-8 */
width: 24%;
}
Update
Thanks for your time but I solve my problem.
Solution: Exists a problem using border-radius and filter in CSS, then just comment this line:
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5ecef',GradientType=0 ); /* IE6-8 */
And works fine!!
Change the contents of the .radius-10 to this:
.radius-10 {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
And for IE9, add the line below, inside the <head> tag.
<meta http-equiv="X-UA-Compatible" content="IE=9" />
And finally, don't forget to add this:
<!DOCTYPE html>
Update
Change the display in #main-login div to block.
This problem is solved by declaring filter: none; for IE9 only. If you use conditional comments to help you get specific classes you may disable thi filter like so:
.ie9 .class-with-gradient {
filter: none;
}
Or add another class for these elements (if there are more than 1) and disable it for them.
Like so:
.gradient {
filter: none;
}
Make sure that only IE9 gets this class. Otherwise - IE8 and IE7 will not get the filter either.

min-height:100% won't apply on a nested div

I have a container div, containing 3 divs, a sidebar, a content and a header while all the elements inside are rendered as they should (they are positioned as "relative" if this may influence in my problem), the sidebar and the content won't render min-height: 100%; no matter what...
my div won't stretch with the min-height as it is supposed to...
here is the code: http://jsfiddle.net/vhZV6/4/
as you can see (I put a white background to best recognize it) the div wich is supposed to stretch simply won't...
Edit: here is a temp site where I tried to implement the solutions... http://www.wabisuke-team.org/Temp/home.html as you can see, all but the last 2 pages (strees and "contattateci") are rendered as they should, but those 2 while have a messed background image out of the div not resizing as it should...
Edit:
I solved this by putting a min-height in pixels, instead of in percentage, it now works as i wanted it to, thanks everyone for your efforts and for you patience ^^
Use height: 100%, there is no need for min-height see here http://jsfiddle.net/vhZV6/5/
html{
height:100%;
}
body {
display:block;
height:100%;
margin: 0;
padding: 0;
overflow:auto;
/* just some back ground and graphical tweeks*/
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
color:#000000;
background: #86acef; /* Old browsers */
background: -moz-linear-gradient(top, #86acef 0%, #baceef 35%, #86acef 70%, #baceef 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#86acef), color-stop(35%,#baceef), color-stop(70%,#86acef), color-stop(100%,#baceef)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #86acef 0%,#baceef 35%,#86acef 70%,#baceef 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #86acef 0%,#baceef 35%,#86acef 70%,#baceef 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #86acef 0%,#baceef 35%,#86acef 70%,#baceef 100%); /* IE10+ */
background: linear-gradient(to bottom, #86acef 0%,#baceef 35%,#86acef 70%,#baceef 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#86acef', endColorstr='#baceef',GradientType=0 ); /* IE6-9 */
}
/* ~~this fixed width container surrounds the other divs~~ */
.container {
height: 100%;
container:overflow;
display:block;
position:relative;
width: 1000px;
background: #FFF url(../img/Graphic/bg.jpg) no-repeat fixed center;
background-size:100% 100%;
background-position:center;
margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
}
.header {
position:relative;
/* header graphical tweeks */
background: #2945c4; /* Old browsers */
background: -moz-linear-gradient(top, #2945c4 0%, #7db9e8 35%, #2945c4 70%, #7db9e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2945c4), color-stop(35%,#7db9e8), color-stop(70%,#2945c4), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #2945c4 0%,#7db9e8 35%,#2945c4 70%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #2945c4 0%,#7db9e8 35%,#2945c4 70%,#7db9e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #2945c4 0%,#7db9e8 35%,#2945c4 70%,#7db9e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #2945c4 0%,#7db9e8 35%,#2945c4 70%,#7db9e8 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2945c4', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */
}
.sidebar1 {
position:relative;
float: left;
width: 180px;
height:100%;
}
.content {
position:relative;
padding: 10px 0;
width: 780px;
float: left;
height:100%;
background: #FFF;
background-size:100% 100%;
background-position:center;
}
​
here is the fiddle with long content http://jsfiddle.net/xM4NC/
and here is with short http://jsfiddle.net/xM4NC/1/
I set body to height 100%, but the content div to min-height 100%. That way it's parent had a defined height, so that div will be at least as tall as the body, but will grow beyond it if necessary. Then added a left margin and floated the sidebar in that space
body {
margin: 0;
padding: 0;
height: 100%;
}
#content {
background: #EEE;
border-left: 1px solid #000;
border-right: 1px solid #000;
padding: 0 20px 0 20px;
margin: auto;
margin-left: 180px;
font: 1.5em arial, verdana, sans-serif;
width: 960px;
min-height: 100%;
}
and the html
<div class="header">header</div>
<div class="sidebar1">sidebar</div>
<div id="content">
text
</div>​