Basically i have a dropdown menu that is not aligning to the middle of the page as you can see below... It is very annoying because i have tried everything i know possible. I would like to keep it in HTML and CSS please as this part i am not using JavaScript or JQuery to do.
CSS Code:
<style type="text/css">
/* TOP MENU DROP DOWN */
#menu li {
color: #222222;
}
#mega {
list-style:none;
font-weight:bold;
}
#mega li {
float:left;
clear:right;
padding-left: 15px;
}
#mega li div div {
float:none;
clear:both;
}
#mega li:hover {
border-bottom:0;
z-index:1;
position:center;
}
#mega a {
color:#000;
text-decoration:none;
}
#mega a:hover {
color:#077fcc;
}
#mega div {
left:-999em;
}
#mega li:hover div {
position:center;
display:block;
left:0;
}
a:hover, #mega div a:focus, #mega div a:active {
text-decoration:none;
}
.popup {
position:fixed;
width:100%;
height:300px;
text-align:center;
vertical-align:middle;
background-image:url(img/dropdownbg.gif);
background-repeat:no-repeat;
background-position:center;
}
.popup-mid {
text-align:left;
position:center;
height:100%;
width:950px;
}
/* TOP INSIDE*/
#top-dropbg {
width:100%;
height:300px;
}
.drop-box {
margin:30px 15px;
height:240px;
}
.drop-sec1 {
float:left;
clear:right;
height:240px;
width:70%;
}
.drop-sec1-1 {
width:100%;
height:20px;
}
.drop-sec1-2 {
float:left;
clear:right;
width:25%;
height:95px;
}
.drop-sec1-3 {
width:100%;
height:5px;
float:left;
clear:left;
border-bottom:1px dotted #CCC;
}
.drop-sec2 {
float:left;
clear:right;
height:240px;
width:1%;
margin-right:1%;
border-right:1px solid #CCC;
}
.drop-sec3 {
float:left;
clear:right;
height:240px;
width:25%;
}
/* END TOP MENU */
h1 {
color:#858585;
font-size:14px;
}
h2{
color:#333333;
font-size:24px;
}
p {
color:#333333;
font-size:14px;
}
</style>
HTML Code:
<div class="navtop">
<div id="menu">
<ul id="mega">
<li>Bookings
<div class="popup">
<div class="popup-mid">
<span id="top-dropbg">
<span class="drop-box">
<span class="drop-sec1">
<span class="drop-sec1-1"><h2>Our Services</h2></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-3"></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
<span class="drop-sec1-2"><h1>Vehicles for Every Pocket</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue.</p></span>
</span>
<span class="drop-sec2">
</span>
<span class="drop-sec3">
<span class="drop-sec3-1"><h1>Membership and Reward Schemes</h1><p>Lorem ipsum etiam at risus et justo dignissim congue donec congue lacinia dui.</p></span>
</span>
</span>
</span>
</div>
</div>
</li>
<li>Explore Our Fleet
<div class="popup">
<div class="popup-mid">
2
</div>
</div>
</li>
<li>Rental Locator
<div class="popup">
<div class="popup-mid">
3
</div>
</div>
</li>
<li>Services
<div class="popup">
<div class="popup-mid">
4
</div>
</div>
</li>
<li>Partners
<div class="popup">
<div class="popup-mid">
5
</div>
</div>
</li>
<li>Specials
<div class="popup">
<div class="popup-mid">
6
</div>
</div>
</li>
<li>Bluechip
<div class="popup">
<div class="popup-mid">
7
</div>
</div>
</li>
</ul>
</div>
</div>
Thank you in advance all :)
add in style
body
{
text-align: center; /* !!! */
margin: 0 auto;
padding: 0;
width:100%;
}
and change this
#mega li {
float:left;
clear:right;
padding-left: 15px;
}
to
#mega li {
display:inline;
clear:right;
padding-left: 15px;
}
Related
I'm fairly new to this, i've been trying to set up a slider caousel on my webpage but i'm struggling to see why the width of my background images are not fitting the entire screen. There's a slight white space on the left side.I'm sure the reason is quite obvious to some but i just can't see it please find my code below.
*
html body
{
margin:0;
padding:0;
}
body{
height:3000px;
}
header
{
height:110px;
line-height: 110px;
position:fixed;
z-index:1;
width:100%;
}
.secondary{
background-color:darkorange;
box-shadow:0px 0px 15px 0px;
transition:all 0.5s ease-in;
}
ul
{
list-style:none;
}
ul li
{
display:inline-block;
}
header nav
{
float: right;
}
.logo img
{
margin-top:25px;
}
header nav ul li a
{
padding-right: 25px;
font-weight: bold;
color: white;
transition: all 0.5s ease-in;
}
header nav ul li a:hover
{
text-decoration: none;
color:black;
}
.img1
{
background-image:linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.7)),url(work.jpg);
background-size:100% 100%;
}
.slider,.slider ul,.slider ul li
{
height:700px;
width:100%;
color:white;
text-align: center;
}
.slider h2
{
font-weight: bold;
margin-top:260px;
}
.slider span
{
color:orange;
}
.slider a
{
padding: 10px 40px;
margin-right: 10px;
}
.slider a.btn-half
{
background-color: orange;
color: white;
}
.slider a.btn-half:hover
{
opacity:0.7;
transition:0.5s ease-in;
}
.slider a.btn-full
{
background-color: black;
color: white;
}
.slider a.btn-full:hover
{
opacity:0.7;
transition:0.5s ease-in;
}
.img2
{
background-image:linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.7)),url(work2.jpg);
background-size:100% 100%;
}
.img3
{
background-image:linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.7)),url(work3.jpg);
background-size:100% 100%;
}
.slider i
{
font-size:30px;
margin-right:10px;
}
<section class="slider">
<ul class="slider-carousel" id="slider-carousel">
<li class="img1">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna
euismod.Praesent nibh leo, auctor vel po
rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis
tellus vitae, eleifend massa
</p><br>
Get Started
Lets Go
</li>
<li class="img2">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna
euismod.Praesent nibh leo, auctor vel po
rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis
tellus vitae, eleifend massa
</p><br>
Get Started
Lets Go
</li>
<li class="img3">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna
euismod.Praesent nibh leo, auctor vel po
rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis
tellus vitae, eleifend massa
</p><br>
Get Started
Lets Go
</li>
</ul>
</section>
You need to set background-size: cover;
Use this code and try.
body {
background-image: url("xxxx.jpg");
}
Suppose image contain in DIV1 and Text Contain in DIV2.
Both Div1 and Div2 are float Left.So I want to hide the padded image.
As my contents of DIV2 are dynamic, so I don't want to set height in any div.
Even box-sizing:padding-box not worked in this code or browser.
My Desire Output like as below image by cropping the Monitor stand:
.monitor-area
{
background:#ebebeb;
height:auto;
}
.monitor-area:after
{
content:'';
display:block;
clear:both;
}
.monitor
{
width:50%;
float:left;
overflow:hidden;
}
.monitor img
{
width:100%;
}
.monitor-content
{
width:44%;
overflow:hidden;
float:right;
padding-right:2%;
}
.monitor-title
{
margin-top:80px;
}
.monitor-title h1
{
color:#333333;
font-size:30px;
font-weight:normal;
text-transform:uppercase;
}
.monitor-text
{
}
<section class="monitor-area">
<div class="monitor">
<img src="https://image.ibb.co/ioQ47Q/monitor.png" alt="448*250px" />
</div>
<div class="monitor-content">
<div class="monitor-title">
<h1>A CATCHY TITLE</h1></div>
<div class="monitor-text">
<p>Cursuspenatisaccum ut curabitur nulla tellus tor
ames a in curabitur pede. Idet mollisi eros dis orci
congue elis et curabitur consequam intesque.
Curabiturpisametur in ante.</p>
</div>
<div class="monitor-button">
<a href="">read more
<i class="fa fa-angle-double-right"></i>
</a>
</div>
</div>
</section>
.monitor-area
{
background:#ebebeb;
height:auto;
}
.monitor-area:after
{
content:'';
display:block;
clear:both;
}
.monitor
{
width:50%;
float:left;
overflow:hidden;
max-height:205px
}
.monitor img
{
width:100%;
}
.monitor-content
{
width:44%;
overflow:hidden;
float:right;
padding-right:2%;
}
.monitor-title
{
margin-top:80px;
}
.monitor-title h1
{
color:#333333;
font-size:30px;
font-weight:normal;
text-transform:uppercase;
}
.monitor-text
{
}
<section class="monitor-area">
<div class="monitor">
<img src="https://image.ibb.co/ioQ47Q/monitor.png" alt="448*250px" />
</div>
<div class="monitor-content">
<div class="monitor-title">
<h1>A CATCHY TITLE</h1></div>
<div class="monitor-text">
<p>Cursuspenatisaccum ut curabitur nulla tellus tor
ames a in curabitur pede. Idet mollisi eros dis orci
congue elis et curabitur consequam intesque.
Curabiturpisametur in ante.</p>
</div>
<div class="monitor-button">
<a href="">read more
<i class="fa fa-angle-double-right"></i>
</a>
</div>
</div>
</section>
HTML Code
<header>
<h1>Event Heading</h1>
<div class="meta">09 JUL 2014</div>
<div class="textblock">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</div>
</header>
Issue
I have this HTML structure which I can not edit/rearrange. I would like to position the h1, div.meta and div.textblock is as in the picture below.
I can't work it out with floats the way I want to because of the sequence of the HTML.
Illustration
This can be achieved with absolute positioning:
header {
position: relative;
min-height: 100px; }
div.meta {
position: absolute;
width: 100px; height:100px;
top:0; left:0;
border: 1px solid red; }
header h1 {
margin-left: 120px;
border-bottom: 2px solid red; }
header div.textblock { margin-left: 120px; }
See fiddle: http://jsfiddle.net/utsKx/
You can change the div.meta widths and h1/textblock margin-left to percentages if you want a responsive layout.
EDIT
Added min-height to header to ensure div.meta never falls outside the parent header block. (Thanks for MarcAudet for pointing this out)
See this example:
Codepen Example
I think this is what you're looking for!
You can use this demo
Code Pen Demo
HTML
<header>
<div class="meta L">09 JUL 2014</div>
<h1 class="R">Event Heading</h1>
<div class="textblock R">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</div>
</header>
CSS
header
{
width:650px;
display:inline-block;
}
.meta
{
width:150px;
height:150px;
border:1px solid red;
margin:5px;
font-size:22px;
text-align:center;
}
h1,.textblock
{
width:400px;
text-align:left;
border:1px solid red;
}
h1
{
color:#B1003B;
margin-top:5px;
}
.textblock
{
margin-top:-22px;
}
.L
{
float:left;
}
.R
{
float:right;
}
.C1
{
color:#000000;
font-weight:bold;
font-size:36px;
}
.C2,.C3
{
color:#777777;
}
JQuery
var str = $(".meta").html();
s = str.split(' ');
$(".meta").html("<span class='C1'>"+s[0]+"</span></br><span class='C2'>"+s[1]+"</span></br><span class='C3'>"+s[2]+"</span>");
I'm having a small issue with one of my divs the #divSidebar not wrapping around it's child divs. It's probably something small that I probably overlooked, but I've been fussing with it for quite sometime. I believe it has something to do with a missing . I can get the content over to the side, but I had to add a innerSideBar div that was floated to the right.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html itemscope itemtype="http://schema.org/Blog" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>Welcome to TutorialHelp!</title>
<link href="css/tutorialHelp.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="divHeaderContainer">
<div id="divHeader">
<div id="divLogo"></div>
<div id="divNavigtation">
<div id="divNavMenu">
<ul>
<li> Home</li>
<li> Tutorials
<ul>
<li>Photoshop
<li>Dreamweaver
<li>Illustrator
<li>Flash
<li>InDesign
</ul>
</li>
<li>Articles</li>
<li>About</li>
<li>Contact</li>
</ul> <!-- end main UL -->
<br class="clearFloat" />
</div>
<div id="divSocial"></div>
</div>
</div>
</div>
<div id="divContentContainer">
<div id="divWrapper">
<div id="divInnerWrapper">
<div id="divContent">
<div id="divBanner"></div>
<div id="divListing">
<header class="listing">
<div id="divListingLeft">
<a href="#" title="The Basics Of Photoshop">
<img width="200px" height="200px" src="images/photoshopBasicsImage.jpg" alt="PhotoshopBasicsImage" title="PhotoshopBasicsImage" />
</a>
<span class="metaWrapper">Photoshop</span>
<span class="metaWrapper">Beginner</span>
</div>
<div id="divListingRight">
<p class="tags">
Tutorials
>>
Photoshop
</p>
<div class="clearFloat"></div>
<p class="date">
Posted on: October 16, 2012 by
</p>
<h1>The Basics Of Photoshop</h1>
<div id="synopsis"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis viverra lacus. Ut volutpat augue nec nulla sodales facilisis. Duis magna mauris, auctor a hendrerit vitae, adipiscing vel ante. Praesent risus elit, egestas a commodo non, suscipit id mauris. Ut ligula velit, tempor vel accumsan sed, sollicitudin quis sem. Integer nunc sem, feugiat non luctus ut, varius quis enim. Curabitur non odio id leo lobortis gravida acac arcu.</p></div>
</div>
<br class="clearFloat" /></header>
</header>
</div>
<div id="divListing">
<header class="listing">
<div id="divListingLeft">
<a href="#" title="Building A Basic Web Page In Dreamweaver">
<img width="200px" height="200px" src="images/dreamweaverBasicWebPageImage.jpg" alt="DreamweaverBasicWebPageImage" title="DreamweaverBasicWebPageImage" />
</a>
<span class="metaWrapper">Dreamweaver</span>
<span class="metaWrapper">Beginner</span>
</div>
<div id="divListingRight">
<p class="tags">
Tutorials
>>
Dreamweaver
</p>
<div class="clearFloat"></div>
<p class="date">
Posted on: October 16, 2012 by
</p>
<h1>Building A Basic Web Page In Dreamweaver</h1>
<div id="synopsis"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis viverra lacus. Ut volutpat augue nec nulla sodales facilisis. Duis magna mauris, auctor a hendrerit vitae, adipiscing vel ante. Praesent risus elit, egestas a commodo non, suscipit id mauris. Ut ligula velit, tempor vel accumsan sed, sollicitudin quis sem. Integer nunc sem, feugiat non luctus ut, varius quis enim. Curabitur non odio id leo lobortis gravida acac arcu.</p></div>
</div>
<br class="clearFloat" /></header>
</header>
</div>
<div id="divListing">
<header class="listing">
<div id="divListingLeft">
<a href="#" title="Designing A Cartoon Environment">
<img width="200px" height="200px" src="images/flashCartoonEnvironmentImage.png" alt="FlashCartoonEnvironmentImage" title="FlashCartoonEnvironmentImage" />
</a>
<span class="metaWrapper">Flash</span>
<span class="metaWrapper">Beginner</span>
</div>
<div id="divListingRight">
<p class="tags">
Tutorials
>>
Flash
</p>
<div class="clearFloat"></div>
<p class="date">
Posted on: October 16, 2012 by
</p>
<h1>Designing A Cartoon Environment</h1>
<div id="synopsis"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis viverra lacus. Ut volutpat augue nec nulla sodales facilisis. Duis magna mauris, auctor a hendrerit vitae, adipiscing vel ante. Praesent risus elit, egestas a commodo non, suscipit id mauris. Ut ligula velit, tempor vel accumsan sed, sollicitudin quis sem. Integer nunc sem, feugiat non luctus ut, varius quis enim. Curabitur non odio id leo lobortis gravida acac arcu.</p></div>
</div>
<br class="clearFloat" /></header>
</header>
</div>
<div id="divBottomBanner"></div>
</div>
<div id="divSidebar">
<div id="divInnerSideBar">
<div id="divAdWrapper">
<div class="adListing">Advertise Here</div>
<div class="adListing">Advertise Here</div>
<div class="adListing">Advertise Here</div>
<br class="clearFloat" />
</div>
<fb:comments href="http://www.facebook.com/pages/Tutorialhelp/497024140318879"
num_posts="4" width="300"></fb:comments>
<fb:like href="http://www.facebook.com/pages/Tutorialhelp/497024140318879" send="true" width="285" show_faces="true" font="verdana"></fb:like>
<div class="clearFloat"></div>
</div>
</div>
<div class="clearFloat"></div>
</div>
</div>
</div>
</body>
</html>
#charset "utf-8";
/* CSS Document */
body{
margin:0px;
padding:0px;
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
color:#000;
min-width:1300px;
background-color:#83ACBC;
}
#divHeaderContainer{
width:100%;
height:200px;
background-color:#CEDBD9;
margin:0px auto;
}
#divHeader{
width:1120px;
height:200px;
min-width:1120px;
margin:0px auto;
background-image: url(../images/backgroundImage_r1_c1_r1_c1.jpg);
background-repeat: no-repeat;
background-position: center bottom;
}
#divLogo{
height:130px;
}
#divNavigation{
height:32px;
position:relative;
background-color:#333;
width:1120px;
}
#divNavMenu {
width:auto;
height:32px;
margin-top: 7px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 10px;
}
#divNavMenu ul {
margin:0;
padding:0;
line-height:30px;
}
#divNavMenu li {
margin:0;
padding:0;
list-style:none;
float:left;
position:relative;
background:#DCE4E3;
}
#divNavMenu ul li a {
text-align:center;
height:30px;
width:148px;
display:block;
color:#000;
font-family:Verdana, Geneva, sans-serif;
text-decoration:none;
border:1px solid #C5D1D0;
font-size: 16px;
font-weight: bold;
}
#divNavMenu ul ul {
position:absolute;
visibility:hidden;
top:32px;
}
#divNavMenu ul li:hover ul {
visibility:visible;
z-index:9999;
}
#divNavMenu li:hover {
background:#83ACBC;
}
#divNavMenu ul li:hover ul li a:hover {
color:#FFF;
background:#9EBECB;
}
#divNavMenu a:hover {
color:#FFF;
}
/* Contains the Float */
.clearFloat {
clear:both;
margin:0;
padding:0;
height:0px;
overflow:hidden;
}
/* IE7 Display Fix */
#divNavMenu ul li {
display: inline;
}
#divContentContainer{
margin:0px auto;
padding-bottom:50px;
width:100%;
background-image: url(../images/backgroundImage_r1_c1_r3_c1.jpg);
background-repeat: no-repeat;
background-position: center bottom;
}
#divWrapper{
width:1120px;
margin:0px auto;
background-image: url(../images/backgroundImage_r1_c1_r2_c1.jpg);
background-repeat: repeat-y;
background-position: center;
}
#divInnerWrapper{
margin:0px auto;
width:1088px;
}
#divContent{
width:738px;
float:left;
margin:0px auto;
}
#divBanner{
width:700px;
height:60px;
margin:0px auto;
padding-bottom:20px;
background-color:#D3DCDA;
}
#divListing{
padding:20px 20px 0px 18px;
margin:15px 0px 0px 0px;
}
.listing{
height:auto;
background:none;
border-bottom:solid 1px #B7B7B7;
}
#divListingLeft{
width:200px;
float:left;
margin:0px 0px 20px 0px;
}
#divListingRight{
width:480px;
float:right;
}
.metaWrapper{
font-family:Verdana, Geneva, sans-serif;
display:block;
width:200px;
font-size:14px;
text-align:center;
font-weight:bold;
color:#000;
}
.tags{
font-style:italic;
}
.date{
font-style:italic;
}
#divContent #divListing p{
padding:0 20px 0px 10px;
}
#divContent #divListing h1{
font-size:26px;
color:#000;
padding:0px 20px 0px 10px;
margin:0px;
}
h1 a{
font-style:normal;
text-decoration:none;
color:#000;
}
#divBottomBanner{
width:700px;
height:60px;
margin:0px auto;
padding-bottom:20px;
margin-top:35px;
background-color:#D3DCDA;
}
h2{
font-weight:bold;
font-size:24px;
margin:30px 0px 0px 20px;
padding-bottom:5px;
border-bottom:solid 1px #B7B7B7;
}
#contactForm{
padding:0px;
display: block;
height: auto;
margin-top: 30px;
margin-right: 160px;
margin-bottom: 0px;
margin-left: 0px;
font-weight: bold;
}
#divSidebar{
}
#divInnerSideBar{
width:300px;
float:right;
}
#divAdWrapper{
width:260px;
height:auto;
}
.adListing{
display:block;
font-size:11px;
background-color:#D3DCDA;
color:#000;
text-align:center;
text-decoration:none;
overflow:hidden;
float:left;
width:125px;
height:125px;
margin: 0px 4px 4px 0px;
}
I've added both html and css code and hopefully that will help you see where the problem is in the code. Any other problems with the code can be brought up, but looking for a solution to the #divSidebar and its child content.
Define your divSidebar
#divSidebar{
float:right;
}
demo
I would like to position a div at the bottom of the page in the left cell if the content in the right cell grows. How can I do this?
The div is located between #cell-right and menu item 1.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>sd</title>
<style type="text/css">
html, body {
width:100%;
background:#6f711a;
border:0px solid red;
margin:0;
padding:0;
font-family:Arial;
}
#wrapper {
width:1220px;
padding:0;
margin:10px auto;
background:#ccc;
border:3px solid white;
}
#content {
background:#444;
float:left;
width:100%;
min-height:620px;
padding:0;
margin:0;
border:0px solid;
}
#cell-left {
background-color:#444;
float:left;
width:195px;
height:100%;
padding:0;
margin:0;
border:0px solid;
}
#cell-right {
float:right;
width:1025px;
height:100%;
padding:0;
margin:0;
border:0px solid;
}
#footer {
background-color:#000;
color:#fff;
clear:both;
height:25px;
padding:4px;
margin:0;
text-align:center;
border:0px solid;
}
#cell-right #content-right{
padding:10px 10px 0 10px;
}
#cell-left #content-left{
padding:0;
margin:0;
}
#content-left {
position:relative;
height:100%
}
#content-right {
background:#f1f1f1;
}
#content-left ul li a {
border-bottom: 1px solid #fff;
color: white;
display: block;
overflow: auto;
padding: 10px;
text-decoration: none;
}
ul {
border: 0 none;
font: bold 13px Verdana;
list-style-type: none;
margin: 0;
padding: 0;
width: 100%;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="content">
<div id="cell-left">
<div id="content-left">
<ul>
<li>menu item 1</li>
</ul>
<div style="vertical-align:bottom;height:100%;">vertically align on bottom</div> This is the div that needs to rest on the bottom
</div>
</div>
<div id="cell-right">
<div id="content-right">
Lorem ipsum dolor sit amet consectetuer eget at enim ac eget.
Tellus nibh non ut congue montes parturient natoque odio at ipsum.
Id aliquet ante arcu feugiat Lorem dis ut libero laoreet dui.
Id tincidunt elit Nulla ut elit Nulla dui ullamcorper magnis ipsum.
Turpis Donec risus Proin tristique egestas hendrerit Vestibulum sed ut orci.
Pede adipiscing a et magna ultrices ipsum Aenean a ut laoreet.
Sed vitae vitae eu nibh pellentesque quis orci vitae at Aenean.
.. lots more of text here ..
</div>
</div>
</div>
<div id="footer">sdsd</div>
</div>
</body>
</html>
Use the same css you have now. Just change body like this:
<body>
<div id="wrapper">
<div id="content">
<div id="cell-left">
<div id="content-left">
<ul>
<li>menu item 1</li>
</ul>
</div>
</div>
<div id="cell-right">
<div id="content-right" style="position:relative">
Lorem ipsum dolor ... bla bla bla
<div style="position:absolute; left:-185px; bottom:10px; width:180px">This is the div that needs to rest on the bottom vertically align on bottom</div>
</div>
</div>
</div>
<div id="footer">sdsd</div>
</div>
</body>
Actually I've changed just these lines:
<div id="content-right" style="position:relative">
Lorem ipsum dolor ... bla bla bla
<div style="position:absolute; left:-185px; bottom:10px; width:180px">This is the div that needs to rest on the bottom vertically align on bottom</div>
</div>
Give the div you want on the bottom a style="position:absolute; bottom:0" and the parent div (in this case the "content-left") a style="position:relative;"