using animations.css for animating - css

I am trying to use animations.css and css3-animate-it.js for making some interesting animations. It is very simple to use and saves lots of time. but when using these files the css file makes my page scroll horizontally.I can't understand why it happens. I only know for sure that it is because of css file.Who have used these files and know the reason?Here is my code:
<div class="description">
<div class="general">
<div class="animatedParent">
<div class='animated bounceInDown'>
<h2>General</h2>
<p> This is Photoshop's version of Lorem Ipsum.
Proin gravida nibh vel velit auctor aliquet. Aenean sollicitudin,
lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit.
Duis sed odio sit amet nibh vulputate cursus a sit amet mauris. Morbi accumsan ipsum velit.
Nam nec tellus a odio tincidunt auctor a ornare odio. Sed non mauris vitae erat consequat
auctor eu in elit. Class aptent taciti sociosqu ad litora torquent per conubia
</p>
<button onclick="show()">MORE...</button>
</div>
</div>
</div>
<div class="religion">
<div class="animatedParent">
<div class='animated bounceInUp'>
<h2>Religion</h2>
<p> This is Photoshop's version of Lorem Ipsum.
Proin gravida nibh vel velit auctor aliquet. Aenean sollicitudin,
lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit.
Duis sed odio sit amet nibh vulputate cursus a sit amet mauris. Morbi accumsan ipsum velit.
Nam nec tellus a odio tincidunt auctor a ornare odio. Sed non mauris vitae erat consequat
auctor eu in elit. Class aptent taciti sociosqu ad litora torquent per conubia</p>
<button>MORE...</button>
</div>
</div>
</div>
<div class="location">
<div class="animatedParent">
<div class='animated bounceInDown'>
<h2>Location</h2>
<p> This is Photoshop's version of Lorem Ipsum.
Proin gravida nibh vel velit auctor aliquet. Aenean sollicitudin,
lorem quis bibendum auctor, nisi elit consequat ipsum, nec sagittis sem nibh id elit.
Duis sed odio sit amet nibh vulputate cursus a sit amet mauris. Morbi accumsan ipsum velit.
Nam nec tellus a odio tincidunt auctor a ornare odio. Sed non mauris vitae erat consequat
auctor eu in elit. Class aptent taciti sociosqu ad litora torquent per conubia</p>
<button>MORE...</button>
</div>
</div>
</div>
</div>
.description{width:1320px;height:auto;
margin:0 auto;
clear:both;
text-align:center;}
.description>div{float:left;}
.general,
.religion,
.location{width:32%;margin:5px;padding-top:30px;background: rgb(245, 245, 242);}

Related

what does the value of "left" and "right" in the "page-break-after" property do?

As I understand it, these two values during printing make it so that after a page break, the next paragraph is set on the left page or right (if the text is arranged like a book when printed), but this does not happen.
It is written that the browser can perceive the values of "left" and "right" as "always" values: if so, why do we need these two values ??
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hayti</title>
<style>
#media print {
p {
page-break-after: left;
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nunc enim, convallis quis purus ut, congue ultricies eros. Vestibulum sit amet lacus maximus, finibus enim nec, gravida felis. Vestibulum pharetra neque sed lorem vestibulum vestibulum. Aenean ornare malesuada varius. Vestibulum hendrerit egestas enim sit amet maximus. Cras ligula lectus, ullamcorper quis turpis id, blandit convallis purus. Integer pulvinar diam sed cursus condimentum. Aenean a pulvinar felis. Ut pellentesque nec diam a malesuada. Nullam dolor felis, iaculis id odio vel, fringilla lacinia magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent nec risus augue. Etiam consequat, mi id dictum tincidunt, nunc diam vehicula neque, vitae interdum sapien elit vel erat. Etiam vulputate turpis eget est molestie malesuada.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nunc enim, convallis quis purus ut, congue ultricies eros. Vestibulum sit amet lacus maximus, finibus enim nec, gravida felis. Vestibulum pharetra neque sed lorem vestibulum vestibulum. Aenean ornare malesuada varius. Vestibulum hendrerit egestas enim sit amet maximus. Cras ligula lectus, ullamcorper quis turpis id, blandit convallis purus. Integer pulvinar diam sed cursus condimentum. Aenean a pulvinar felis. Ut pellentesque nec diam a malesuada. Nullam dolor felis, iaculis id odio vel, fringilla lacinia magna. Interdum et malesuada fames ac ante ipsum primis in faucibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent nec risus augue. Etiam consequat, mi id dictum tincidunt, nunc diam vehicula neque, vitae interdum sapien elit vel erat. Etiam vulputate turpis eget est molestie malesuada.</p>
</body>
</html>
enter image description here
I think you've misunderstood the property's effect.
p {page-break-after: left;} Forces page breaks after the p element so that the next page is formatted as a left page.
It doesn't mean that it moves the next paragraph on the left page

Which CSS settings can prevent `position: sticky` from working?

I have a somewhat complex HTML document that contains different elements with position: sticky. These elements are on different levels in the hierarchy: there are several sticky sidebars, several headers where the lower header "pushes away" the upper header when the user scrolls up, etc.
With some of these elements, position: sticky works okay, but other elements behave like position: relative. There seems to be some connection to the hierarchy level and to the parent elements: on some levels, position: sticky works okay, on other levels (or inside certain parent elements), it doesn't work. I'm currently not able to see a pattern, and changing some CSS properties (trial-and-error) did not help.
Before I go on with trial-and-error, it could help to know which CSS properties (of the element or its ancestors) are able to prevent position:sticky from working. In other words, which conditions have to be satisfied for position:sticky?
I think I discovered the reason: if an element is contained in another element which has overflow:hidden, then position:sticky is ignored.
See the following snippet, which I adapted from #Daniel's:
.parent {
position: relative;
background: #ccc;
width: 500px;
height: 150px;
overflow: auto;
margin-bottom: 20px;
}
.hidden-overflow {
overflow: hidden;
}
.sticky {
position: sticky;
background: #333;
text-align: center;
color: #fff;
top: 10px;
}
<div class="parent">
<div>
<div class="sticky">
Hi, I am a sticky inside the container which contains the first paragraph.
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat sed metus et porttitor. Integer bibendum lacus eget massa ultricies fermentum. Donec cursus magna eu congue posuere. Sed eget ligula quam. Sed laoreet enim sapien, eget volutpat nisl pellentesque vel. Nulla id dolor sed dolor sodales tristique. Curabitur feugiat massa sed massa bibendum semper et ac orci. In imperdiet nibh quis iaculis viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque vestibulum, nunc non volutpat tristique, nisl nisi volutpat nibh, quis pulvinar purus ex nec justo. Sed a cursus turpis. Quisque nulla odio, lacinia quis vestibulum sit amet, elementum laoreet nisi. Etiam aliquet ligula sagittis,
consectetur ipsum sit amet, sodales augue.
</p>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat sed metus et porttitor. Integer bibendum lacus eget massa ultricies fermentum. Donec cursus magna eu congue posuere. Sed eget ligula quam. Sed laoreet enim sapien, eget volutpat
nisl pellentesque vel. Nulla id dolor sed dolor sodales tristique. Curabitur feugiat massa sed massa bibendum semper et ac orci. In imperdiet nibh quis iaculis viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Quisque vestibulum, nunc non volutpat tristique, nisl nisi volutpat nibh, quis pulvinar purus ex nec justo. Sed a cursus turpis. Quisque nulla odio, lacinia quis vestibulum sit amet, elementum laoreet nisi. Etiam aliquet ligula sagittis,
consectetur ipsum sit amet, sodales augue.
</p>
<p>
Integer congue augue a quam tincidunt, vitae dictum sem iaculis. Proin feugiat nibh vitae leo facilisis, eget laoreet augue dictum. Nunc facilisis tempor feugiat. Aenean eget interdum diam. Maecenas non risus iaculis, scelerisque ipsum eu, facilisis urna.
Integer velit justo, vestibulum vel vulputate vel, bibendum eu lorem. Phasellus viverra nisl a mi pretium eleifend.
</p>
</div>
<div class="parent">
<div class="hidden-overflow">
<div class="sticky">
Hi, I am another sticky in the container which contains the first paragraph, but my container has overflow:hidden.
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat sed metus et porttitor. Integer bibendum lacus eget massa ultricies fermentum. Donec cursus magna eu congue posuere. Sed eget ligula quam. Sed laoreet enim sapien, eget volutpat nisl pellentesque vel. Nulla id dolor sed dolor sodales tristique. Curabitur feugiat massa sed massa bibendum semper et ac orci. In imperdiet nibh quis iaculis viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque vestibulum, nunc non volutpat tristique, nisl nisi volutpat nibh, quis pulvinar purus ex nec justo. Sed a cursus turpis. Quisque nulla odio, lacinia quis vestibulum sit amet, elementum laoreet nisi. Etiam aliquet ligula sagittis,
consectetur ipsum sit amet, sodales augue.
</p>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat sed metus et porttitor. Integer bibendum lacus eget massa ultricies fermentum. Donec cursus magna eu congue posuere. Sed eget ligula quam. Sed laoreet enim sapien, eget volutpat
nisl pellentesque vel. Nulla id dolor sed dolor sodales tristique. Curabitur feugiat massa sed massa bibendum semper et ac orci. In imperdiet nibh quis iaculis viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Quisque vestibulum, nunc non volutpat tristique, nisl nisi volutpat nibh, quis pulvinar purus ex nec justo. Sed a cursus turpis. Quisque nulla odio, lacinia quis vestibulum sit amet, elementum laoreet nisi. Etiam aliquet ligula sagittis,
consectetur ipsum sit amet, sodales augue.
</p>
<p>
Integer congue augue a quam tincidunt, vitae dictum sem iaculis. Proin feugiat nibh vitae leo facilisis, eget laoreet augue dictum. Nunc facilisis tempor feugiat. Aenean eget interdum diam. Maecenas non risus iaculis, scelerisque ipsum eu, facilisis urna.
Integer velit justo, vestibulum vel vulputate vel, bibendum eu lorem. Phasellus viverra nisl a mi pretium eleifend.
</p>
</div>
However I'm not sure about the reason for this behaviour. The container with overflow:hidden is itself a child of the scrolling container, so it does not prevent the scrolling. I'm not sure why such an element can't be sticky.
I have no knowledge of sticky, so my findings are based on playing with it. Hope it will help you. I find in the eaxample that if sticky does not have a top rule in the CSS, it behaves like a relative. Is that what you refer to?
.parent {
position: relative;
background: #ccc;
width: 500px;
height: 150px;
overflow: auto;
margin-bottom: 20px;
}
.sticky1 {
position: sticky;
background: #333;
text-align: center;
color: #fff;
}
.sticky2 {
position: sticky;
background: #333;
text-align: center;
color: #fff;
top: 10px;
}
<div class="parent">
<div class="sticky1">
Hi, I am sticky1 without a top
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat sed metus et porttitor. Integer bibendum lacus eget massa ultricies fermentum. Donec cursus magna eu congue posuere. Sed eget ligula quam. Sed laoreet enim sapien, eget volutpat
nisl pellentesque vel. Nulla id dolor sed dolor sodales tristique. Curabitur feugiat massa sed massa bibendum semper et ac orci. In imperdiet nibh quis iaculis viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Quisque vestibulum, nunc non volutpat tristique, nisl nisi volutpat nibh, quis pulvinar purus ex nec justo. Sed a cursus turpis. Quisque nulla odio, lacinia quis vestibulum sit amet, elementum laoreet nisi. Etiam aliquet ligula sagittis,
consectetur ipsum sit amet, sodales augue.
</p>
<p>
Integer congue augue a quam tincidunt, vitae dictum sem iaculis. Proin feugiat nibh vitae leo facilisis, eget laoreet augue dictum. Nunc facilisis tempor feugiat. Aenean eget interdum diam. Maecenas non risus iaculis, scelerisque ipsum eu, facilisis urna.
Integer velit justo, vestibulum vel vulputate vel, bibendum eu lorem. Phasellus viverra nisl a mi pretium eleifend.
</p>
</div>
<div class="parent">
<div class="sticky2">
Hi, I am sticky2 with a top
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus volutpat sed metus et porttitor. Integer bibendum lacus eget massa ultricies fermentum. Donec cursus magna eu congue posuere. Sed eget ligula quam. Sed laoreet enim sapien, eget volutpat
nisl pellentesque vel. Nulla id dolor sed dolor sodales tristique. Curabitur feugiat massa sed massa bibendum semper et ac orci. In imperdiet nibh quis iaculis viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
himenaeos. Quisque vestibulum, nunc non volutpat tristique, nisl nisi volutpat nibh, quis pulvinar purus ex nec justo. Sed a cursus turpis. Quisque nulla odio, lacinia quis vestibulum sit amet, elementum laoreet nisi. Etiam aliquet ligula sagittis,
consectetur ipsum sit amet, sodales augue.
</p>
<p>
Integer congue augue a quam tincidunt, vitae dictum sem iaculis. Proin feugiat nibh vitae leo facilisis, eget laoreet augue dictum. Nunc facilisis tempor feugiat. Aenean eget interdum diam. Maecenas non risus iaculis, scelerisque ipsum eu, facilisis urna.
Integer velit justo, vestibulum vel vulputate vel, bibendum eu lorem. Phasellus viverra nisl a mi pretium eleifend.
</p>
</div>
I just notice (in chrome) that parent display: block prevent child from being sticky. display: inline fixed this.

Vertically align elements between bootstrap rows

This is a JSFiddle that shows my attempt at positioning 3 buttons at the bottom of 3 columns. I have used flexbox to make sure that all 3 columns have the same height, but in order to make the buttons positioned at the bottom of each column, I had to make them absolutely positioned. As a result, the size of the buttons, is not taken in account for the column's size. Is there any proper way to avoid that (without using placeholder elements/margins/etc)?
HTML:
<div class="container">
<div class="row row-same-height">
<div class="col-md-4">
<h2>Responsive</h2>
<!--<h4> εξαρτημένη από το ένα άκρο </h4>-->
<p style="text-align: justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id varius leo. Aliquam erat volutpat. Proin tempor lorem et dolor sollicitudin, in dignissim arcu blandit. Nullam consectetur rutrum pretium. Vivamus imperdiet elementum neque,
vel volutpat leo mattis in. Nam luctus pellentesque dui sed vulputate. Curabitur faucibus fringilla lectus, ut aliquet mauris dictum facilisis.</p>
<p class="stick-to-bottom"><a class="btn btn-primary" href="per1.html" role="button">View
details »</a></p>
</div>
<div class="col-md-4">
<h2>But</h2>
<p style="text-align: justify">Aliquam id congue libero. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed ullamcorper sapien nulla, eget fermentum est mattis non. Morbi tortor tellus, sollicitudin quis nisi at, hendrerit faucibus nisl. Aenean consequat felis
urna, ut eleifend sapien tempus a. Phasellus porta mi non venenatis condimentum. Aliquam ut dolor eleifend, maximus quam vitae, scelerisque leo. Praesent metus est, lobortis eget urna a, luctus condimentum eros. Curabitur gravida maximus augue
molestie ultricies. Mauris ac urna ac lorem sagittis auctor. Etiam facilisis rhoncus sapien, at aliquam ligula euismod ac. Vestibulum quis condimentum neque. Morbi ornare aliquam consectetur. Mauris ipsum ligula, vulputate sed tristique hendrerit,
pellentesque fringilla nisl.</p>
<p class="stick-to-bottom"><a class="btn btn-primary" href="per2.html" role="button">View
details »</a></p>
</div>
<div class="col-md-4">
<h2>Wrong</h2>
<p style="text-align: justify">Duis eu nibh viverra, pretium risus id, egestas odio. Suspendisse potenti. Praesent aliquet massa sit amet nunc bibendum pellentesque. Mauris consectetur auctor magna vel consequat. Aliquam sit amet nunc quam. Vivamus eu nisi ac est viverra vehicula
lobortis sit amet lorem. Cras ut pellentesque nisi. Curabitur ornare imperdiet quam sit amet efficitur. Vivamus viverra felis at bibendum aliquam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec
vestibulum, quam id efficitur consequat, ipsum dolor sollicitudin augue, id mollis erat risus quis urna. Integer aliquet suscipit orci, vehicula cursus lectus malesuada in. </p>
<p class="stick-to-bottom"><a class="btn btn-primary" href="per3.html" role="button">View
details »</a></p>
</div>
</div>
</div>
<hr>
<div class="container">
<div class="row row-same-height">
<div class="col-md-4">
<h2>Looks as intended</h2>
<!--<h4> εξαρτημένη από το ένα άκρο </h4>-->
<p style="text-align: justify">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id varius leo. Aliquam erat volutpat. Proin tempor lorem et dolor sollicitudin, in dignissim arcu blandit. Nullam consectetur rutrum pretium. Vivamus imperdiet elementum neque,
vel volutpat leo mattis in. Nam luctus pellentesque dui sed vulputate. Curabitur faucibus fringilla lectus, ut aliquet mauris dictum facilisis.</p>
</div>
<div class="col-md-4">
<h2>But</h2>
<p style="text-align: justify">Aliquam id congue libero. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed ullamcorper sapien nulla, eget fermentum est mattis non. Morbi tortor tellus, sollicitudin quis nisi at, hendrerit faucibus nisl. Aenean consequat felis
urna, ut eleifend sapien tempus a. Phasellus porta mi non venenatis condimentum. Aliquam ut dolor eleifend, maximus quam vitae, scelerisque leo. Praesent metus est, lobortis eget urna a, luctus condimentum eros. Curabitur gravida maximus augue
molestie ultricies. Mauris ac urna ac lorem sagittis auctor. Etiam facilisis rhoncus sapien, at aliquam ligula euismod ac. Vestibulum quis condimentum neque. Morbi ornare aliquam consectetur. Mauris ipsum ligula, vulputate sed tristique hendrerit,
pellentesque fringilla nisl.</p>
</div>
<div class="col-md-4">
<h2>Not Responsive</h2>
<p style="text-align: justify">Duis eu nibh viverra, pretium risus id, egestas odio. Suspendisse potenti. Praesent aliquet massa sit amet nunc bibendum pellentesque. Mauris consectetur auctor magna vel consequat. Aliquam sit amet nunc quam. Vivamus eu nisi ac est viverra vehicula
lobortis sit amet lorem. Cras ut pellentesque nisi. Curabitur ornare imperdiet quam sit amet efficitur. Vivamus viverra felis at bibendum aliquam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec
vestibulum, quam id efficitur consequat, ipsum dolor sollicitudin augue, id mollis erat risus quis urna. Integer aliquet suscipit orci, vehicula cursus lectus malesuada in. </p>
</div>
</div>
<div class="row">
<p class="col-md-4"><a class="btn btn-primary" href="per1.html" role="button">Viewdetails »</a></p>
<p class="col-md-4"><a class="btn btn-primary" href="per2.html" role="button">View details »</a></p>
<p class="col-md-4"><a class="btn btn-primary" href="per3.html" role="button">View details »</a></p>
</div>
</div>
CSS:
.row-same-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.stick-to-bottom {
position: absolute;
bottom: 0;
}
You're already using flexbox, so use flexbox. Why on earth would you absolutely position?
All you'll need is to flex the columns vertically (use flex-direction: column) and use justify-content: space-between. You'll also probably want to put: flex: 1 on the <p> tags that have the text content in them (since the content varies in length):
.row-same-height .col-md-4 {
display: flex;
flex-flow: column nowrap; /* a shorthand for `flex-direction` and `flex-wrap` */
justify-content: space-between;
}
.row-same-height p:first-of-type {
flex: 1;
}
And add whatever vendor prefixes you like. Here's your updated Fiddle. Cheers!

Bootstrap 3 - Re-ordering 2 column layout for mobile (content not vertically aligned)

I've created a quick demo of the problem I'm having here: http://www.bootply.com/Nb2PUnwINT
The behaviour for small screens and below is perfect here, but on medium/large screens the yellow column I want to be along side the green one.
Is this possible? Hopefully I've provided enough detail here.
Please check with the below code
<div class="row">
<div class="col-sm-12 col-md-9 col-lg-9">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12" style="background-color:green">
Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque porta felis a ex egestas ultrices. Duis vel lorem nulla. Vestibulum eget risus nec felis hendrerit aliquet. Sed et tempus tellus. Curabitur congue magna lacus, facilisis rhoncus neque finibus hendrerit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
Nunc sed viverra nunc. Ut venenatis dapibus odio vel viverra. Nullam sem justo, scelerisque et fringilla quis, ullamcorper id diam. Suspendisse vitae justo porta, molestie diam vitae, pulvinar nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam ut felis lacus. Etiam quis pretium dolor. Nulla eu rutrum erat. Ut hendrerit et diam ac eleifend. Suspendisse mollis elit lorem, ultrices fermentum erat convallis mattis. Duis congue mattis magna non elementum. Ut ultricies vitae ante sit amet tempor.
</div>
</div>
</div>
<div class="col-sm-12 col-md-3 col-lg-3">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12" style="background-color:red">
Lorem ipsum dolor sit a
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12" style="background-color:yellow">
met, consectetur adipiscing elit. Vestibulum eget odio ut lectus dignissim varius. Praesent volutpat, dui quis ultricies pellentesque, sem ipsum volutpat libero, in fermentum leo nisl a orci. Praesent gravida elit ac felis interdum, at elementum lacus tristique. Curabitur dignissim metus tristique vehicula iaculis. Quisque mattis tincidunt tellus, et aliquet arcu aliquet ut. Vestibulum vel metus nec ipsum sagittis aliquet in sit amet erat. Praesent pellentesque sit amet massa sed lobortis. Proin blandit consectetur egestas. Nulla cursus tortor turpis, nec tempor metus viverra et. Quisque id auctor arcu, ac posuere eros. Curabitur ac tincidunt purus. Integer scelerisque quis ex vitae volutpat. Donec non pretium turpis.
Duis dolor felis, convallis non venenatis ut, vulputate in ipsum. Etiam nisi tortor, finibus sit amet tellus non, bibendum sollicitudin enim. Proin in mollis neque, id faucibus felis. Proin cursus tristique mollis. Proin eget aliquam orci. Suspendisse egestas consequat magna quis ornare. Duis maximus dui sit amet neque fermentum aliquam.
</div>
</div>
</div>
</div>

<p> element pushing down form

I've been trying to fix this the past hour, I just can't figure it out. The last <p> element in my main div is pushing down my form and I don't know why. How do I get rid of that white space above the form?
Here's the live site
CSS:
div.main {
h1 {width: 50%;}
.number {width: 46%;}
p {width: 50%; margin: 2% 0 2% 2%; float: left; }
}
form.contact {
width: 46%;
float: right;
margin: 0;
input, textarea {display: block; padding: 5px; margin: 5px 0; width: 95%;}
textarea {height: 130px;}
}
HTML:
<div class="main clearfix">
<h1>Glasgow Joiner</h1><span class="number">01698 818209</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, turpis at laoreet gravida, nunc ipsum faucibus mauris, nec semper risus massa vel dolor. Maecenas egestas consequat arcu at porttitor. Pellentesque placerat feugiat nisl, sed volutpat risus ultricies eu. Quisque luctus orci quis odio blandit consectetur. Pellentesque tristique est eu nisi molestie pulvinar. Vestibulum pharetra id nisl eu ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis viverra condimentum orci, vitae vestibulum diam tempor ut. Suspendisse blandit egestas lacus vel vestibulum. Integer eleifend augue nec rutrum sagittis. Vivamus lobortis molestie rutrum. Vestibulum congue lacus ac semper malesuada.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, turpis at laoreet gravida, nunc ipsum faucibus mauris, nec semper risus massa vel dolor. Maecenas egestas consequat arcu at porttitor. Pellentesque placerat feugiat nisl, sed volutpat risus ultricies eu. Quisque luctus orci quis odio blandit consectetur. Pellentesque tristique est eu nisi molestie pulvinar. Vestibulum pharetra id nisl eu ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis viverra condimentum orci, vitae vestibulum diam tempor ut. Suspendisse blandit egestas lacus vel vestibulum. Integer eleifend augue nec rutrum sagittis. Vivamus lobortis molestie rutrum. Vestibulum congue lacus ac semper malesuada.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, turpis at laoreet gravida, nunc ipsum faucibus mauris, nec semper risus massa vel dolor. Maecenas egestas consequat arcu at porttitor. Pellentesque placerat feugiat nisl, sed volutpat risus ultricies eu. Quisque luctus orci quis odio blandit consectetur. Pellentesque tristique est eu nisi molestie pulvinar. Vestibulum pharetra id nisl eu ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis viverra condimentum orci, vitae vestibulum diam tempor ut. Suspendisse blandit egestas lacus vel vestibulum. Integer eleifend augue nec rutrum sagittis. Vivamus lobortis molestie rutrum. Vestibulum congue lacus ac semper malesuada.</p>
<form class="contact">
<h2>Get a FREE Quote Today!</h2>
<label for="name">Name:</label>
<input type="text" name="name">
<label for="email">Email Address:</label>
<input type="text" name="email">
<label for="phone">Telephone Number:</label>
<input type="text" name="phone">
<label for="message">Message:</label>
<textarea name="message"></textarea>
<input type="submit">
</form>
</div>
It is floating to the right of the last cleared element. Put the form directly after the H1 and span and you'll see it at the top-right.
Better approach is wrap paragraphs with divs, and set float: left; to both elements:
<div class="main clearfix">
<div class="content">
<h1>Glasgow Joiner</h1><span class="number">01698 818209</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, turpis at laoreet gravida, nunc ipsum faucibus mauris, nec semper risus massa vel dolor. Maecenas egestas consequat arcu at porttitor. Pellentesque placerat feugiat nisl, sed volutpat risus ultricies eu. Quisque luctus orci quis odio blandit consectetur. Pellentesque tristique est eu nisi molestie pulvinar. Vestibulum pharetra id nisl eu ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis viverra condimentum orci, vitae vestibulum diam tempor ut. Suspendisse blandit egestas lacus vel vestibulum. Integer eleifend augue nec rutrum sagittis. Vivamus lobortis molestie rutrum. Vestibulum congue lacus ac semper malesuada.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, turpis at laoreet gravida, nunc ipsum faucibus mauris, nec semper risus massa vel dolor. Maecenas egestas consequat arcu at porttitor. Pellentesque placerat feugiat nisl, sed volutpat risus ultricies eu. Quisque luctus orci quis odio blandit consectetur. Pellentesque tristique est eu nisi molestie pulvinar. Vestibulum pharetra id nisl eu ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis viverra condimentum orci, vitae vestibulum diam tempor ut. Suspendisse blandit egestas lacus vel vestibulum. Integer eleifend augue nec rutrum sagittis. Vivamus lobortis molestie rutrum. Vestibulum congue lacus ac semper malesuada.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, turpis at laoreet gravida, nunc ipsum faucibus mauris, nec semper risus massa vel dolor. Maecenas egestas consequat arcu at porttitor. Pellentesque placerat feugiat nisl, sed volutpat risus ultricies eu. Quisque luctus orci quis odio blandit consectetur. Pellentesque tristique est eu nisi molestie pulvinar. Vestibulum pharetra id nisl eu ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis viverra condimentum orci, vitae vestibulum diam tempor ut. Suspendisse blandit egestas lacus vel vestibulum. Integer eleifend augue nec rutrum sagittis. Vivamus lobortis molestie rutrum. Vestibulum congue lacus ac semper malesuada.</p>
</div>
<div class="right">
<form class="contact">
<h2>Get a FREE Quote Today!</h2>
<label for="name">Name:</label>
<input type="text" name="name">
<label for="email">Email Address:</label>
<input type="text" name="email">
<label for="phone">Telephone Number:</label>
<input type="text" name="phone">
<label for="message">Message:</label>
<textarea name="message"></textarea>
<input type="submit">
</form>
</div>
</div>
It will be easier to add more elements for sidebar. And for future I suggest use something like grind css template.
If you remove all of your margin, u may logically figure out why!
Put all of your p tags into a div and make it 50% float left
Name it after me:
<div id="left_keo">
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
</div>
<div id="right_keo">
<form>
...
</form>
</div>
There are 100000000 and 1 ways of doing it, but 1st, you need a stable layout, 2nd: you need to keep your code clear and clean!!!
That's the very very basic of layouting.
The reason it is doing this is because:
Try visualizing each individual paragraph as a gigantic letter. In a normal book, the letters would go directly to its right, and go to the next line when it runs out of space. If the paragraph has no space to go to the right, then it will go below. However, the form is small enough to go to the right of it.
Try putting the form and the text in two different divs, then have the paragraph-div and the form-div both float left.
Or, you can make another div inside the main clearfix, and put the form inside that.
Either way, they should both float left, and putting the form and paragraphs inside the same div next to each other can result in these glitches.

Resources