I'm trying to change my footers margin so that it expands to the width of the webpage, instead it still seems to be affect by the 50px of left/right margin I added to my #content section. What property am I missing here so I can remove the affect of the content's margins on my footer section?
Html
<div id="wrapper" />
<div id="header" />
<div id="mast"><img src="http://i1256.photobucket.com/albums/ii488/terafanb/guildwars2/26.png" height="99" width="774=" /></div>
<div id="below-mast" />
<div id="left" class="column"><img src="http://i157.photobucket.com/albums/t60/Dragon_Aleph/fantasy_warrior_23022-800x600.jpg" height="297" width="226" border="0" alt="Crusader Army" /></div>
<div id="center" class="column"><img src="http://i157.photobucket.com/albums/t60/Dragon_Aleph/fantasy_warrior_23022-800x600.jpg" height="297" width="400" border="0" alt="Crusader Army" /></div>
<div id="right" class="column"><img src="http://i157.photobucket.com/albums/t60/Dragon_Aleph/fantasy_warrior_23022-800x600.jpg" height="297" width="139" border="0" alt="Crusader Army" /></div>
<div></div>
<div id="content" />
<p>
<div class="Heading">Forward Exchange *</div>
$500.00 - collected upon the closing of the Relinquished Property.
$500.00 - collected upon closing of each Replacement Property purchased.
* Special credits may apply - Call Us.<br /></br>
<div id="we-pay">
<br />
<div class="Heading">We pay interest</div>
</br>
We provide full disclosure of the fees involved in the transaction in the Exchange Agreement. Our customers are entitled to receive earned interest based on the First National Bank of Durango Investment Money Market rate, from the time when the Relinquished Property funds are initially deposited. Interest does not accrue on those funds withdrawn during the first 30 calendar days after the funds are deposited in the Exchange Trust Account. Also, interest does not accrue if customer elects to have exchange funds held at First National Bank of Durango in an Unlimited FDIC insurance non-interest bearing account (available through December 31, 2012)
</div>
<br />
<div class="Heading">
Safe-Harbor Reverse Exchange <br />
<h2>We charge the following fees:</h2>
</div>
<div id="prices">$2,500.00 – Title holding fee<br />
$500.00 – LLC fee<br />
$200.00 – Monthly Rent<br />
Plus – Forward Exchange fees<br />
<br />
</div>
<div id="note">
<p>Note: If any improvements need to be made to the parked property,
being held by the EAT ( Exchange Accommodator Titleholder )
there will be an additional fee of 1% of the final sales price to Taxpayer.
</p>
<div>
<br /></br>
<div id="disclaimer">Fees are subject to change without prior notice</p></div>
</div>
<div id="footer">
Home
<strong>l</strong> What is a 1031 Exchange? <strong>l</strong> <a href="exchangeRequ.html">
1031 Exchange Requirements</a> <strong>l</strong> Types of Exchanges <br />
<div id="Second-Half">
How to get Started <strong>l</strong>
Why CLX?<strong>l</strong> Resources <strong>l</strong> FAQs <strong>l</strong> Fees
Contact Us
</div>
</div>
</div>
CSS
*{box-sizing:border-box;}
#wrapper {margin-left:auto; margin-right:auto;width:774px;}
#below-mast { width:774px; overflow:hidden; }
#left {height:297px; width:29%; margin:4px;margin-left:0px;}
#center{height:297px; width:51%; margin:4px;}
#right {height:297px; width:17%; margin:4px;}
#left, #center, #right { float:left;margin-bottom:50px;}
#content{overflow:;margin:0px;margin-top:100px;font-family:Arial, Helvetica, sans-serif;margin-right:50px;margin-left:50px;}
.Heading{font-size:19px;font-weight:bold;text-align:center; text-decoration:underline}
.Heading>h2{font-size:13px;text-decoration:none}
#we-pay{font-size:13px}
#we-pay>.Heading{font-size:20px;text-decoration:none;}
#prices{text-align:center; font-size:20px;}
#note{text-align:center;}
#disclaimer{font-size:13px; text-align:center; font-weight:bold;font-style:italic; }
#footer{margin-right:-50px;margin-left:-50px;}
#footer,a:link{font-family:Helvetica, sans-serif;color:#300000; margin-top:50px;}
#Second-Half{margin-left:auto; margin-right:auto;width:450px;}
Here is a link to my code on Code Pen for your convience
http://codepen.io/Austin-Davis/pen/rLeEi
Your bug can be fixed with the following piece of code:
#footer { margin: 0; position: absolute; left: 0; width: 100%; }
Please checkout: http://codepen.io/joe/pen/uBikf
PS: I gave the footer a gray background for testing purpose.
Sorry guys I was just missing a closing </div> on my #note section making the footer part of the content section, thus making any margin changes to the footer via css useless.
Another solution would be to move the footer outside of the #wrapper div.
Also please check your HTML.. it´s broken in so many places that fixing the css problem might be impossible ;)
eg. you have alot of selfclosing tags "" (not valid)
Also you are missing closing body tag, none exsisting tags "" etc etc..
Related
I would like to add spacing between these div elements.
How can I do that?
<div style="clear: left;">
<p class="image"><img src="https://blog.proven.com/wp-content/uploads/zipsqaure.jpg" height="200" width="200" border="1px"></p>
<p class="rating"><strong><font size="4">Proven Rating: <font color="#0077b3">★★★★★</font></font></strong></p>
<p class="description">ZipRecruiter allows employers to post jobs within minutes and reach over 200 million active job seekers. </p>
</div>
<div style="clear: left;">
<p class="image"><img src="https://blog.proven.com/wp-content/uploads/snag-1.png" height="200" width="200" border="1px"></p>
<p class="rating"><strong><font size="4">Proven Rating: <font color="#0077b3">★★★★★</font></font></strong></p>
<p class="description">Snagajob allows employers to reach over 80 million job seekers through their job board. It was founded in 1999 and continues to be one of the top job boards today, hosting one of the largest hourly employee networks on the web.</p>
</div>
Define a margin for each element or
use Something like this to set it to all elements within a div
div *{
margin:10px;
}
I'm very new to this so I apologise if this is a simple thing. I seem to be unable to keep the bottom div inside the wrapper, even though it closes after. I've validated the code and this hasn't helped. Please can someone cast some light on where I'm going wrong? Many thanks in advance.
This is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans:300|Raleway:300,700|Droid+Serif:700' rel='stylesheet' type='text/css'>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<meta name="viewport" content="width=device-width; initial-scale=0.95; maximum-scale=1.0; user-scalable=no;"/>
<link href="/css/simplegrid.css" rel="stylesheet" type="text/css" >
<link href="css/a_main_structure.css" rel="stylesheet" type="text/css" />
<link href="css/birthgently.css" rel="stylesheet" type="text/css" />
<link href="css/menu_styling.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Optima' rel='stylesheet' type='text/css'>
<style type="text/css">
a:link {
color: #8A8A8A;
text-decoration: none;
}
a:visited {
color: #8A8A8A;
text-decoration: none;
}
a:hover {
color: #5F5F5F;
text-decoration: none;
}
a:active {
color: #5F5F5F;
text-decoration: none;
}
body {
background-color: #F4F4F4;
background-repeat: repeat-x;
}
</style>
</head>
<body text="#000000" link="#0000ff" dir="ltr" lang="en-GB">
<div id="container">
<div id="content">
<div class="wrapper">
<div class="width_100_percent" align="center">
<div class="headerStretch">
<img src="images/birthgently-topstrip.jpg" width="960" height="232" alt="alt tag change me"/>
</div>
</div>
<div align="center">
<div class="menuback">
<div class="paddingtop8px">
<nav>
<ul align="centre">
<li>Home</li>
<li>Weekly Class</li>
<li>The Course</li>
<li>Hypnobirthing</li>
<li>Contact</li>
<li>Bookings</li>
</ul>
</nav>
</div>
</div>
</div>
<br />
<div class="width_100_percent">
<div class="width7_percent"> </div>
<div class="width86_percent"><div class="headerStretch"><img src="images/about-hypnobirthing.jpg" width="800" height="469" alt="alt tag change me" /></div></div>
<div class="width7_percent"> </div>
</div>
<br />
<br />
<br />
<br />
<div class="clear_both">
<div class="width_100_percent">
<br />
<br />
<div class="width15_percent"> </div>
<div align="center" class="width70_percent">
<div align="left"><h1 class="contentheadings">The principles of Hypno-birthing</h1>
</div>
<p align="left" class="bodytext">Giving birth calmly, safely and gently is every woman's and every baby's birth right. A woman's body has been perfectly designed to give birth to her baby. Free of fear, stress and anxiety her body is able to work in synchrony with her baby to naturally produce a beautiful blend of birthing hormones. <br/>
<br/>
When a woman is calm and relaxed the muscles which assist in the birth her baby are able to work harmoniously and effectively which means she has an easier, more gentle birth that is often also accompanied by a significant reduction in pain. These wonderful birthing hormones and muscles help to ensure that a woman can have the amazing, beautiful and profound experience that nature intended birth to be.
</p>
</div>
<div class="width15_percent"> </div>
</div>
</div>
<br />
<br />
<br />
<br />
<div class="clear_both">
<div class="width_100_percent">
<div class="width29_percentquotes-right">
<img src="images/open-quotes.jpg" width="30" height="20" alt=""/> If the birth is calm, gentle & drug free for you, it's also calm, gentle & drug free for your baby - K Graves <img src="images/close-quotes.jpg" width="30" height="20" alt=""/></div>
<div align="center" class="width50_percent">
<div align="left">
<p class= "bodytext">Hypno-birthing is not about training mothers to give birth. It is about helping woman to release fear and anxiety and it teaches them how to use self-hypnosis and relaxation so their bodies and minds can relax and they can birth their babies gently. <br />
<br />
Hypno-birthing is now widely recognised by birth professionals and is regularly discussed in the media. Hypno-birthing is commonly accepted as an effective approach to childbirth with many midwives training in the technique having witnessed 'hypno-births' first-hand. </p>
</div>
</div>
<div class="width15_percent"> </div>
</div>
</div>
<div class="clear_both">
<div class="width_100_percent">
<br />
<br />
<div class="width15_percent"> </div>
<div align="center" class="width70_percent">
<div align="left">
<h2 class="contentsubheadings">The History of Hypno-birthing</h2>
</div>
<p align="left" class="bodytext">More natural and gentle approaches to childbirth including hypno-birthing began in modern times with the work, amongst others, of Dr Grantly Dick-Read, an obstetrician working in England in the early 19th century. His careful observations of women giving birth led him to develop the theory of the 'fear-tension-pain syndrome'.
</p>
</div>
<div class="width15_percent"> </div>
</div>
</div>
<div class="clear_both">
<div class="width_100_percent"><br />
<div class="width15_percent"> </div>
<div align="center" class="width50_percent">
<div align="left">
<p class="bodytext">Having witnessed women giving birth easily, calmly and comfortably he concluded that what made the process of birth painful was fear. Fear caused tension in the woman's body and disrupted the natural processes of labour and birth. Dr Dick-Read documented the negative effect of fear on childbirth. In his books he argued that childbirth did not have to be the painful ordeal that women had been led to believe they must suffer. He suggested that when fear is not present a woman can give birth comfortably and pain-free.</p></div>
</div>
</div>
</div>
<div class="width35_percent">
<div class="headerStretch">
<div class="image-pad-left"><img src="images/about-hypno.jpg" width="265" height="177" /></div></div></div>
<div class="width15_percent"> </div>
<div class="clear_both">
<div class="width_100_percent">
<div class="width29_percentquotes-right">
<img src="images/open-quotes.jpg" width="30" height="20" alt=""/> My dream is that every woman, everywhere, will know the joy of a truly safe, comfortable, and satisfying birthing for herself and her baby. Marie Mongan <img src="images/close-quotes.jpg" width="30" height="20" alt=""/></div>
<div align="center" class="width50_percent">
<div align="left">
<p class= "bodytext">Unfortunately the view that labour and birth are painful and traumatic continues to be one which is still widely circulated in the media. Even amongst well meaning friends and family the negative view often persists and pregnant women are frequently bombarded with negative and fear evoking images and stories..</p><br />
</div>
</div>
<div class="width15_percent"> </div>
</div>
</div>
<div class="clear_both">
<div class="width_100_percent">
<br />
<br />
<div class="width15_percent"> </div>
<div align="center" class="width70_percent">
<div align="left">
<h2 class="contentsubheadings">Getting past fear</h2>
</div>
<p align="left" class="bodytext">One of the main elements of hypno-birthing is the removal of such fears and the use of positive images, positive language and positive affirmations about birth. Marie Mongon, an American hypnotherapist was one of the first people to use the phrase HypnoBirthing. She developed a teaching program for parents to be which she brought to the UK in the early 90's. Since then hypno-birthing has gained in popularity and many practitioners including Katherine Graves have gone on to adapt and enhance hypno-birthing techniques specifically for the UK.
There are now many hypno-birthing practitioners and whilst each have a slightly different approach the key elements of hypno-birthing remain the same - free of fear and tension a woman can give birth to her baby calmly, safely, gently.</p>
</div>
<div class="width15_percent"> </div>
</div>
</div>
<div class="clear_both">
<div class="width_100_percent"><br />
<div class="width15_percent"> </div>
<div align="center" class="width50_percent">
<div align="left"><h2 class="contentsubheadings">birthgently classes
</h2>
<ul type="square">
<li type="square" class="bullets">
<p class="bodytext">teaches deep relaxation which keeps you and your birth partner free of stress and fear</p></li>
<li type="square" class="bullets">
<p class="bodytext"> facilitates your body's production of powerful, natural pain relieving endorphins and feel good hormones</p></li>
<li type="square" class="bullets">
<p class="bodytext"> helps to shorten the length of the first stage of labour</p></li>
<li type="square" class="bullets">
<p class="bodytext"> reduces the need for surgical interventions</p></li> <li type="square" class="bullets">
<p class="bodytext">helps to keep baby calm and well oxygenated</p></li>
<li type="square" class="bullets">
<p class="bodytext"> eaves you and baby feeling calm but alert and able to fully experience those special first few hours together </p></li>
<li type="square" class="bullets">
<p class="bodytext"> empowers you and your birth partner to remain calm and in control even if there are unexpected circumstances</p></li>
</ul>
</div>
</div>
</div>
</div>
<div class="width35_percent">
<div class="headerStretch">
<div class="image-pad-lefttop"><img src="images/grey-baby.jpg" width="265" height="177" /></div></div></div>
<div class="width15_percent"> </div>
<div class="clear_both">
<div class="width_100_percent">
<br />
<br />
<div class="width15_percent"> </div>
<div align="center" class="width70_percent">
<div align="left">
<h2 class="contentsubheadings">The common view</h2>
</div>
<p class= "bodytext" align="left">
Unfortunately the view that labour and birth are painful and traumatic continues to be one which is still widely circulated in the media. Even amongst well meaning friends and family the negative view often persists and pregnant women are frequently bombarded with negative and fear evoking images and stories..</p>
</div>
<div class="width15_percent"> </div>
</div>
</div>
<div class="clear_both">
<div class="width_100_percent">
<div class="width50_percentquotes-right">
<img src="images/open-quotes.jpg" width="30" height="20" alt=""/> My son was born at 4:50am. I sat back having been on all fours, and just stared at him swimming up on his back, eyes open in the water. The midwife had to prompt me to pick him up. I came out of this trance-like state and I scooped him up and suddenly the power of speech returned and I felt euphoric. <br />
AB -hypno-birthing Mum <img src="images/close-quotes.jpg" width="30" height="20" alt=""/></div>
<div align="left" class="width35_percent">
<br />
</div>
</div>
<div class="width15_percent"> </div>
</div>
</div>
</div>
</div>
</body>
</html>
I've had a look at this and cant see what is or isn't happening as desired. Take a look at this JSFIDDLE I've added border the main container and bottom div and it is sitting within the container.
Take a look yourself, add this css to your page to see whats going on
#container
{
border: 1px solid blue;
}
.width15_percent
{
border: 1px solid red;
}
Add overflow: hidden; to .wrapper
i'm a little rusty on html and css and i cant get 2 images to float, one on top of the other. heres the code...
<div class="kbody">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
<div id="ktxt">
<p>          
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews. </p>
</div>
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
</div>
and the css...
.kbody {
width:800px;
margin-left: auto;
margin-right: auto;
/*border-style:solid;
border-width:3px;*/
}
.kimg1 {
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
float:left;
}
.kimg2 {
padding-left:5px;
padding-top:5px;
padding-bottom:5px;
float:left;
margin-top:10px;
}
#ktxt {
padding-left:10px;
padding-right:10px;
padding-top:10px;
/*border-width:2px;
border-style: solid;*/
width:350px;
height:330px;
margin-left:402px;
font-style:arial, sans-serif;
color: #336699;
font-size:14pt;
}
what am i doing wrong??
heres what it looks like with this code
http://imgur.com/a/ivDE2#0
To move the second image under the first:
.kimg2 {
clear: both;
}
<div class="kbody">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
<div id="ktxt">
<p>          
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews. </p>
</div>
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
<div style="clear:both"></div>
</div>
Put a clearfix between the elements you want to show them in separate lines. I would write a global css rule like .clearfix { clear: both; } and put a div before the second image;
Instead of writing bunch of use CSS text-indent property;
Sample Code:
<div class="kbody">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto">
<div id="ktxt">
<p>
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews.
</p>
</div>
<div class="clearfix"></div>
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto">
</div>
try to wrap your image
html
<div class="kbody">
<div class="imageWrapper">
<img class="kimg1" src="img1.jpg" alt=" " width="375px" height="auto" />
<img class="kimg2" src="img3.jpg" alt=" " width="375px" height="auto" />
</div>
<div id="ktxt">
<p>          
Kristallnacht occurred on November 9-10, 1938. Also known as the night of
broken glass, it was an organized attack on the Jews. Hitler had Nazis all over
Germany and Austria that burned synagogues, broke store windows, stole from the
stores, killed a couple dozen Jews, and arrested twenty thousand more. A few days
later Germany made an "atonement fine" that added up to over one billion dollars
and placed it on the remaining Jews. </p>
</div>
</div>
css
.imageWrapper {
float:left;
width:375px;
}
hope this help you
easier way is <img src="yourimage.jpg" align="left" />
As you want your picture to be floated to left side is not possible as you do. So, you should define your html alternatively for what you want as..
<div class="kbody">
<div class="kimg">
<img ..image1../>
<img ..image2../>
</div>
<div id="ktext">your text...</div>
</div>
Now define the css.
hints:
.kimg{width: 300px;}
#ktext{width: 300px;}
I have an unwanted space in my lists. The code is below but I have 3 column lists of about 8 rows, but the last rows first list item is causing an unwanted space. Almost looks like it just entirely moves over to the next column with nothing in its place. Not sure why. Other than that last row the lists are working fine. Any help?
html
<div id="museums" class="clearfix">
<div class="entry">
<p>The Art Institute of Chicago</p>
<p>Art</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>The Field Museum</p>
<p>Natural History</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Museum of Contemporary Art</p>
<p>Art</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Museum of Science and Industry</p>
<p>Science and Technology</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Adler Planetarium</p>
<p>Universe</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>The Chicago History Museum</p>
<p>History</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Museum of Broadcast Communications</p>
<p>Radio and Television</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>The Shedd Aquarium</p>
<p>Marine Life</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>The Notebaert Nature Museum</p>
<p>Nature</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>DuSable Museum of African American History</p>
<p>African American History</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Frank Lloyd Wright Home and Studio</p>
<p>Architecture</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>National Museum of Mexican Art</p>
<p>Mexican Culture</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Jane Addams Hull House Museum</p>
<p>Social Welfare </p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Abraham Lincoln Museum</p>
<p>History</p>
<p>Chicago ,
Illinois</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
<div class="entry">
<p>Rebecca's Test Museum</p>
<p>Test</p>
<p>St. Paul,
Minnesota</p><br />
<div class="edit">
<!--JH - allow only logged in users to see edit and delete links-->
Edit<br />
Delete
<br />
View
</div>
</div>
</div>
css
div.entry {
position: relative;
width: 30%;
float: left;
margin: 0 30px 10px 0;
padding: 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
div.entry p:first-child {
width: 290px;
line-height: 1.2em;
font-size: 25px;
color: #E07951;
margin-bottom: 3px;
padding: 0px;
}
div.entry p:nth-child(2) {
font-size: 17px;
}
div.entry p {
font-size: 15px;
line-height: 1.4em;
margin: 0px;
margin-bottom: 3px;
padding: 0px;
}
.edit {
padding-top: 10px;
}
This is due to the way floating elements work. It orders the elements left-to-right based on exactly the order you have them in the HTML, but the element on the second to last row is actually longer than the other elements on the right, so when the next row occurs, it will place the following elements in the most reasonable (to the browser) location, which is directly to the right underneath the immediate row. This results in the very last item appearing as if it's a new row.
Visually speaking, this is occurring:
+-+-+-+
|A|B|C|
+-+-+-+
|D|E|F|
| +-+-+
+-+G|H|
|I+-+-+
+-+
Short of using min-height to have a guaranteed length in your typical browsing environment, or perhaps even tables (ew!), there's not a good way to solve for this in CSS.
There is, however, a javascript solution. It's a jQuery plugin called Masonry. I recommend it for this type of situation.
It's also worth noting that Masonry helps things stay consistent for column displays no matter how many columns are possible (mobile environments, wide screen monitors, etc.).
#d_r_w very well explained the problem with floats.
You can try display: inline-block; vertical-align: top; on each of your blocks.
Here is a fiddle
Limitations:
contrary to tables or (better) display: table-cell;, your blocks won't really be of same height. On white background, all is well and the problem with floats described by d_r_w is gone but if you add a background or a border around each box, you'll see that they each have the height of their content. You still can add a background shorter than any content, on the first 3 lines for example.
mixing width in % and padding in px easily makes 3 div larger than 100% for many viewport widths. :( You'd better use only % (partially done in the fiddle)
inline-block will output whitespace as a space, as for any whitespace between, say, two span. If you don't want these ~4 px (3*33.33% + 3* 4px > 100% width and badaboom, see above), you've to add an HTML comment between each div </div><!-- nothing --><div> or output in your template NO whitespace, nil, nada (and add a comment for your colleagues on why it's done like that).
Other solution that will request extra div for each line/row: display: table; /* and table-row and table-cell */
Compatibility: IE8+, and back to "inline-block" for IE6/7 (that is, display: inline; zoom: 1; equals inline-block on those old browsers)
it is float issue.
the div that contains "DuSable Museum of African American History" has a bigger height than other divs. so it pushes the divs from next row.
2 things we can do
1) set a fixed height for each div
eg: add hegiht: 300px; or sth like that to div.entry
2) if fixed height is not possible, then add <div style="clear:both"></div> after every 3rd div in html markup.
Hi there,
I am trying to build a web page and i have the following problem. I tried to upload a photo but I cannot because I don't have enough votes. I have a contacts page and my problem is that there is a huge gap between the contacts (little photos with people) and the grey layer in the bottom (please vote for me so that I can upload a photo to show you what I mean). I am really confused and I don't know where the problem might be. Here I give some information:
I have created two lists (divs) with photos and contacts (in this picture you can see 2 photos of the leftlist (as i called it) div and one photo of the rightlist div.
The CSS for these two are the following:
#leftlist {
width:430px;
position: relative;
left: 0px;
top: 0px;
bottom: 720px;}
#rightlist {
width:430px;
position: relative;
left: 450px;
bottom: 720px;
top: -670px;}
These two divs I placed them inside the white box as you can see from the photo which I named container. The CSS for container is:
.container {
width:950px;
margin-top: 0;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;}
Here I add the whole code of the container including whats inside:
<div class="container">
<div class="box">
<div class="border-top">
<div class="border-right">
<div class="border-bot">
<div class="border-left">
<div class="left-top-corner">
<div class="right-top-corner">
<div class="right-bot-corner">
<div class="left-bot-corner">
<div class="inner">
<h2> </h2>
<h2 align="center">Sales and Customer Service Team</h2>
<h2 align="center"><br />
<br />
</h2>
<div id="leftlist">
<ul class="list2">
<li>
<img alt="" src="images/blabla.jpg" />
<h4><strong>blabla </strong>
President<br />
<br />
<span class="style100">Email: blabla#sblabla.it</span><br />
<span class="style100">Tel: +39 02 00000001</span><br />
</h4></li>
<li></li>
<br />
<li>
<img alt="" src="images/blabla.jpg" />
<h4><strong>blabla </strong>
General Sales Manager<br />
<br />
<span class="style100">Email: blabla#blabla.it</span><br />
<span class="style100">Tel: +39 02 00000023</span><br />
</h4>
</li>
<li></li>
<br />
<li>
<img alt="" src="images/blabla.jpg" />
<h4><strong>blabla </strong>
Sales Manager<br />
<br />
<span class="style100">Email: blabla#sblabla.it</span><br />
Tel: +39 02 00000021<br />
</h4></li>
<li></li>
<br />
<li>
<img alt="" src="images/lara.jpg" />
<h4><strong>Lara blabla</strong>
Sales and Logistics<br />
<br />
<span class="style100">Email: lara.blabla#blabla.it</span><br />
Tel: +39 02 00000022<br />
</h4></li>
<li></li>
<br />
</ul>
</div>
<div id="rightlist">
<ul class="list2">
<li>
<img alt="" src="images/blabla.jpg" />
<h4><strong>blabla</strong>
Laboratory Manager and Quality Control<br />
<br />
<span class="style100">Email: blabla#blabla</span><br />
Tel: +39 02 00000020<br />
</h4></li>
<li></li>
<br />
<li>
<img alt="" src="images/blabla.jpg" />
<h4><strong>blabla</strong>Technical Department<br />
<br />
<span class="style100">Email: blabla#blabla.it</span><br />
Tel: +39 02 00000012<br />
</h4></li>
<li></li>
<br />
<li>
<img alt="" src="images/blabla.jpg" />
<h4><strong>blabla</strong>Safety Manager<br />
<br />
<span class="style100">Email: blabla#blabla.it</span><br />
Tel: +39 02 00000011<br />
</h4></li>
<li></li>
</ul>
</div>
</div>
<div align="center"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- box end -->
</div>
Tip: there are more photos and contact details that are not visible in the photo I upload as i wanted to show you the gap between the container div and the next div (grey layer).
I am really sorry in advance if I am asking something stupid but I've been working on this for 8 hours now and I can't seem to find a solution. Maybe the solution is really stupid but my brain feels like its frying right now :p
Right, there are a couple of issues with the code you have here, most notably the number of divs you are using (I assume that's just for the rounded corners?). However I believe your issue is caused by the positioning of the #leftlist and #rightlist. I can't see a reason for these to be position:relative (also when used you should only set the top value or the bottom value, not both (e.g. 'top:0px' OR 'bottom:0px').)
What is happening is you are moving the #rightlist from it's default position under the #leftlist. Because you are using position:relative and not position:absolute the original position is retained. The extra whitespace you are seeing is where the #rightlist should, by default, appear.
I would not use position in this instance. A better alternative is to use 'float:left' on both lists. If you do this your css will end up being the same for each list - try this:
#leftlist
#rightlist {
width:430px;
float:left;
}
This may collapse the #container div which can be fixed in a number of ways, the simplest being adding 'overflow:hidden;height:100%' to #container. A quick google search should provide many more options if required.
Another alternative would be to use 'display:inline-block' instead of 'float:left' although this can cause issues in older browsers - it really depends on what browsers you need to support.
Hope this helps put you on the right track. Please leave a comment if I'm not being clear and I'll edit my response!
You could try the following in order to attempt to identify where the problem lies:
Install the Web Developer add-on in Firefox, load up your page then use the 'Outline Block Level Elements' option to get a visual display of all the elements that make up your page.