I want to send my text to the right as the images below , but however when I want to send it. it doesnt work can I fix it? my html looks like this . if someone can help me with this i will appreciate
Here is HTML structure and CSS:
div#mapdiv2 {
width: 512px;
}
div#map {
width: 512px;
}
div#panodiv {
float: left;
width: 50%;
}
div#panodiv2 {
width: 512px;
}
div#mapdiv2 h2,
div#map h2,
div#panodiv2 h2,
div#pano h2 {
font-size: 15px;
}
div#mapdiv2 p,
div#map p,
div#panodiv2 p,
div#pano p {
font-size: 11px;
}
div#pano {
width: 512px;
}
div#mapdiv2 img,
div#map img,
div#panodiv2 img,
div#pano img {
width: 10%;
}
<div class="content_feactures">
<h1>Feacture</h1>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing elit. Aenean commodo ligula eget dolor Aenean massa Aenean commodo <span>ligula eget dolor Aenean commodo ligula eget dolor ligula eget dolor Aenean commodo ligula eget dolor</span></p>
<div class="wrap_feactures">
<div class="wrap_feactures_content">
<div id="mapdiv">
<div id="mapdiv2">
<img src="img/check.png">
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
<div id="map">
<img src="img/check.png">
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
</div>
<div id="panodiv">
<div id="panodiv2">
<img src="img/check.png">
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
<div id="pano">
<img src="img/check.png">
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
</div>
</div>
</div>
</div>
Here is what i try to achieve
Your h2 and p are by default display: block, which means it will take 100% width of their parent.
Easiest solution is to wrap h2 and p in div with a class, and asign flex to their parents:
<div id="pano">
<img src="img/check.png">
<div class="wrapper">
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
</div>
then CSS:
#pano {
display: flex;
width: 50%;
justify-content: center;
align-content: center;
text-align: left;
}
#pano img {
width: 100px; //Or what ever you want
}
#pano .wrapper {
flex: 1;
}
Repeat with other divs.
You can add display:inline-block; ti the <img> CSS and also try something like this:
<div id="mapdiv2">
<img src="img/check.png">
<div class="special">
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
</div>
and
.special{
width: 80%;
display:inline-block;
}
Play around with the widths and margins until you get the result you want
My advice is to rap the text in a div or give both a class
<div id="map">
<img src="img/check.png">
<div class="text"
<h2>Lorem ipsum dolor sit amet consectetuer adipiscing elit.</h2>
<p>Lorem ipsum dolor sit amet consectetuer adipiscing<span>eget dolor Aenean massas</span></p>
</div>
</div>
css
div#map img {
width: 10%;
float: left;
}
div#map .text {
width: 90%; /*or any width*/
float: rigth;
}
Use floats to direct them to where you want them to saty
This should work
Related
I have three columns inside a section tag in HTML but they sit on top of each other instead of standing next to eachother.
<section class="sec-top">
<div style="background-color:#f4f5f9">
<div class="column">
<h2 style="padding-left: 100px; padding-top:40px; color:#3d7cc9;">Lorem ipsum dolor sit amet.</h2>
<p style="padding-left:100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac pharetra turpis. Sed vitae orci.
</p>
<ul class="checkmark">
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Duis eu lorem ut risus sollicitudin bibendum.</li>
<li>uspendisse malesuada augue sit amet ipsum laoreet, eget consequat purus consequat.</li>
</ul>
</div>
<div class="column">
<img class="gify" src="../../assets/apps.gif" />
</div>
<div class="column">
<div class="backgroundBlue">
<h2 class="ptop">Lorem Ipsum</h2>
<h3>Lorem ipsum dolor sit amet.s</h3>
<iframe width="90%" frameborder="0"></iframe>
</div>
</div>
</div>
</section>
I am not sure what I am doing wrong or why this is happening. Any help is appreciated. Thanks!
A div is a block-level element. That means that even if you reduce it's width it will still cause a new line to be created:
A block-level element always starts on a new line and takes up the
full width available (stretches out to the left and right as far as it
can). https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
See also: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout/Block_and_Inline_Layout_in_Normal_Flow
You need to either change the display value of .column (or its parent) or remove it from the normal flow with a float.
See examples below.
In the first example, I added float:left to the column class. This removes each column from the normal flow and they are stacked to the left of the screen.
In the second example, I changed the container div to the flexbox model and added flex: 1 1 33% to each column. This will cause each column to always take up 33% of the width of the parent. Here is a great resource on flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.column {
width: 33%;
float: left;
}
.clearfix::after {
content: "";
display: block;
clear: both;
}
.gify {
max-width: 100%;
}
.flex-parent {
display: flex;
flex-direction:row;
}
.flex-parent>.column {
flex: 1 1 33%;
float: none;
}
<section class="sec-top">
<strong>Using Float</strong>
<div style="background-color:#f4f5f9;" class="clearfix">
<div class="column">
<h2 style="padding-left: 100px; padding-top:40px; color:#3d7cc9;">Lorem ipsum dolor sit amet.</h2>
<p style="padding-left:100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac pharetra turpis. Sed vitae orci.
</p>
<ul class="checkmark">
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Duis eu lorem ut risus sollicitudin bibendum.</li>
<li>uspendisse malesuada augue sit amet ipsum laoreet, eget consequat purus consequat.</li>
</ul>
</div>
<div class="column">
<img class="gify" src="https://via.placeholder.com/450" />
</div>
<div class="column">
<div class="backgroundBlue">
<h2 class="ptop">Lorem Ipsum</h2>
<h3>Lorem ipsum dolor sit amet.s</h3>
<iframe width="90%" frameborder="0"></iframe>
</div>
</div>
</div>
</section>
<section class="sec-top" style="margin-top:30px">
<strong>Using FlexBox</strong>
<div style="background-color:#f4f5f9;" class="flex-parent">
<div class="column">
<h2 style="padding-left: 100px; padding-top:40px; color:#3d7cc9;">Lorem ipsum dolor sit amet.</h2>
<p style="padding-left:100px;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac pharetra turpis. Sed vitae orci.
</p>
<ul class="checkmark">
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Duis eu lorem ut risus sollicitudin bibendum.</li>
<li>uspendisse malesuada augue sit amet ipsum laoreet, eget consequat purus consequat.</li>
</ul>
</div>
<div class="column">
<img class="gify" src="https://via.placeholder.com/450" />
</div>
<div class="column">
<div class="backgroundBlue">
<h2 class="ptop">Lorem Ipsum</h2>
<h3>Lorem ipsum dolor sit amet.s</h3>
<iframe width="90%" frameborder="0"></iframe>
</div>
</div>
</div>
</section>
I am trying to create a div like the one found on youtube.com on the left side (where one finds all the options like trending, subscribed, etc.) which connects from top to bottom and stays while scrolling.
My Markup -
.navDiv {
/* Need to give the navDiv its dimentions */
/* height: 50px; */
width: 220px;
border-right: 1px solid rgba(41, 41, 41, 1);
height: 500px;
padding-left: 0px;
position: fixed;
top: 0;
bottom: 0;
/* background-color: white; */
}
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="navDiv">
<div class="logo">
<img id="logoImage" src="images/logo.png">
<!-- <img id="logoImage" src="images/logo.png"> -->
</div>
<div class="navBarItems">
<button class="profileItem">My Profile</button>
<button class="exploreItem">Explore</button>
<button class="uploadItem">Upload</button>
<!-- <ul>
<li class="profileItem">My Profile</li>
<li class="exploreItem">Explore</li>
<li class="uploadItem">Upload</li>
</ul> -->
</div>
</div>
</body>
</html>
I think you're looking for something like this:
.navDiv {
position: fixed;
width: 220px;
}
.content {
margin-left: 220px;
}
<div class="navDiv">
<div class="logo">
<img id="logoImage" src="images/logo.png">
</div>
<div class="navBarItems">
<button class="profileItem">My Profile</button>
<button class="exploreItem">Explore</button>
<button class="uploadItem">Upload</button>
</div>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</div>
.navDiv {
position: fixed;
width:200px;
top:0px;
left:0px;
right:0px;
bottom:0px;
background-color:#ccc;
}
.logo{
width:100%;
float:left;
text-align:center;
padding: 5px 0px
}
.navBarItems{
width:100%;
float:left;
}
.profileItem,.exploreItem,.uploadItem{
width:100%;
float:left;
margin:3px 0px;
cursor:pointer;
}
.content {
margin-left: 220px;
}
<div class="navDiv">
<div class="logo">
<img id="logoImage" src="images/logo.png">
</div>
<div class="navBarItems">
<button class="profileItem">My Profile</button>
<button class="exploreItem">Explore</button>
<button class="uploadItem">Upload</button>
</div>
</div>
<div class="content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p>
</div>
I am trying to achieve a layout similar to the attached image. It looks fine and as how I want it when displayed in a browser, but when I test on a mobile/tablet device the spacing of the p tags ends up not correctly displayed- I assume this is due to me using hard coded widths in my span tags and the p tags taking up more than one line.
Is it possible to achieve the attached image layout in a responsive manner? If so how do I go about doing this?
I have tried using % and EM in place of px with similar results.
The HTML that I have written so far is:
<h2>Lorem Ipsum </h2>
<p>
<span style="display:inline-block; width: 50px;"></span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat.
</p>
<p>
<span style="display:inline-block; width: 100px;"></span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat.
</p>
</br>
<h4>
<span style="display:inline-block; width: 200px;"></span>
or
</h4>
</br>
<p>
<span style="display:inline-block; width: 50px;"></span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat
</p>
<p>
<span style="display:inline-block; width: 100px;"></span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat.
</p>
</br>
<h2>
<span style="display:inline-block; width: 550px;"></span>
Lorem Ipsum
</h2>
<p>
<span style="display:inline-block; width: 600px;"></span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
</p>
<p>
<span style="display:inline-block; width: 663px;"></span>
Lorem Ipsum
</p>
<p>
<span style="display:inline-block; width: 650px;"></span>
Lorem ipsum dolor sit amet
</p>
First of all, you better walk this way to achieve something similar to what you want:
.indent-1 {
margin-left: 2.5%;
}
.indent-2 {
margin-left: 5%;
}
.indent-3 {
margin-left: 7.5%;
}
.indent-4 {
margin-left: 10%;
}
.indent-5 {
margin-left: 12.5%;
}
.indent-6 {
margin-left: 15%;
}
.indent-7 {
margin-left: 17.5%;
}
.indent-8 {
margin-left: 20%;
}
.indent-9 {
margin-left: 22.5%;
}
<h2>Lorem Ipsum </h2>
<p class="indent-1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat.</p>
<p class="indent-2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat.</p>
<h4 class="indent-3">or</h4>
<p class="indent-4">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat</p>
<p class="indent-5">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper volutpat.</p>
<h2 class="indent-6">Lorem Ipsum</h2>
<p class="indent-7">Lorem ipsum dolor sit amet, consectetur adipiscing elit. ipsum dolor sit amet, consectetur adipiscing elit. Curabitur</p>
<p class="indent-8">Lorem Ipsum</p>
<p class="indent-9">Lorem ipsum dolor sit amet</p>
CodePen using LESS: http://codepen.io/anon/pen/MweYma
JSFiddle using CSS: https://jsfiddle.net/c80p3pyx/1/
If you need to make sure your paragraphs do not wrap, just add
p { white-space: nowrap; }
to your CSS. This way your paragraphs will always stay in one line, but lines that do not fit the screen width will cause the browser to show (or make available at least) a horizontal scrollbar, which in almost all cases you will want to avoid. The only other option on "too-long" paragraphs is to either shorten the text, or to use a smaller font.
Container : relative positioned. Have two child div left and right column having 60% and 30% width of container.
Left child : absolute positioned . Top:0; Left:0; width: 60%;
Right child : absolute positioned . Top:0; right:0; width: 30%;
Footer: Relative positioned.
But footer comes up. Code Given below. Visit the following code LIVE here
can anyone tell me whats wrong in the following code, I think technically all correct.
<style type="text/css">
#container {
position: relative;
margin:0 auto;
width: 1000px;
background: #C63;
padding: 10px;
height:auto;
}
#leftCol {
position: absolute;
top:10px;
left:10px;
background: #e8f6fe;
width: 60%;
}
#rightCol {
position: absolute;
top:10px;
right:10px;
width:30%;
background: #aafed6;
}
.box {
position:relative;
clear:both;
background:#F39;
}
</style>
<div id="container">
<div id="leftCol">
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
</div>
<div id="rightCol">
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
</div>
</div>
<div class="box">
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
</div>
You will have to mention the height of the #container div. Like this
#container {
background: none repeat scroll 0 0 #CC6633;
height: 240px; // mention height
margin: 0 auto;
padding: 10px;
position: relative;
width: 1000px;
}
change margin 0 auto to margin: 0 auto 228px;
Demo: http://jsfiddle.net/KwB5r/
#container {
position: relative;
/*margin:0 auto;*/
margin: 0 auto 228px;
width: 1000px;
background: #C63;
padding: 10px;
height:auto;
}
or set the heigth of you container to 228px for example
You should leave the position: absolute rule from the <div> tags that are inside <div id="container">. And also should add the rule display: inline-block; to the right and left <div> tags:
<style type="text/css">
#container {
position: relative;
margin:0 auto;
width: 1000px;
background: #C63;
padding: 10px;
height:auto;
}
#leftCol {
display: inline-block;
top:10px;
left:10px;
background: #e8f6fe;
width: 60%;
}
#rightCol {
display: inline-block;
top:10px;
right:10px;
width:30%;
background: #aafed6;
}
.box {
position:relative;
clear:both;
background:#F39;
}
</style>
<div id="container">
<div id="leftCol">
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
</div>
<div id="rightCol">
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
</div>
</div>
<div class="box">
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
<p>Lorem ipsum dolor sit amet,consectetuer adipiscing elit. Phasellus varius eleifend. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.Phasellus varius eleifend.</p>
</div>
I have tried coding the HTML layout in the image below, but as a result does not seem to be working correctly. Any help with the error would be appreciated.
HTML:
<header>
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pharetra rutrum tem <br> por. Curabitur at rhoncus orci. Donec ante velit, scelerisque vitae tincidunt sit amet.</p>
</header>
<section>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</section>
CSS:
body {
font-family: 'open sans';
text-align: center;
color: #333;
}
section {
display: block;
}
h1, h2 {
font-weight: 300;
}
Desired Layout:
You should split your section into two, by headings, so that you can float them separately:
<header>
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pharetra rutrum tem <br> por. Curabitur at rhoncus orci. Donec ante velit, scelerisque vitae tincidunt sit amet.</p>
</header>
<section>
<article>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</article>
<article>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</article>
</section>
And for your CSS:
body {
font-family: 'open sans';
text-align: center;
color: #333;
}
section {
display: block;
overflow: hidden;
}
section > article {
box-sizing: border-box;
float: left;
width: 50%;
}
h1, h2 {
font-weight: 300;
}
I recommend using box-sizing: border-box because it will not break the layout when you add padding to the <article> element.
See fiddle here - http://jsfiddle.net/teddyrised/XPGb7/
Wrap your content in left & right containers as:
<header>
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pharetra rutrum tem <br> por. Curabitur at rhoncus orci. Donec ante velit, scelerisque vitae tincidunt sit amet.</p>
</header>
<section>
<div class="left">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</div>
<div class="right">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</div>
</section>
And apply the following style
body {
font-family: 'open sans';
text-align: center;
color: #333;
}
section {
display: block;
}
h1, h2 {
font-weight: 300;
}
.left, .right{
width: 50%;
}
.left{
float: left;
}
.right {
float: right;
}
Working example:
http://jsbin.com/aragem/1/
You will need to wrap your section into two div blocks:
<section>
<div>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur.
<br>Curabitur at rhoncus orci. Lorem ipsumm.</p>
</div>
<div>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur.
<br>Curabitur at rhoncus orci. Lorem ipsumm.</p>
</div>
</section>
So you can apply the following style:
section > div {
display: inline-block;
width: 45%;
}
http://jsfiddle.net/samliew/8XJ7F/3/
this will work :
html :
<header>
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam pharetra rutrum tem <br> por. Curabitur at rhoncus orci. Donec ante velit, scelerisque vitae tincidunt sit amet.</p>
</header>
<section>
<div class="left">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</div>
<div class="right">
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur. <br> Curabitur at rhoncus orci. Lorem ipsumm.</p>
</div>
</section>
css :
body {
font-family: 'open sans';
text-align: center;
color: #333;
}
section {
display: block;
}
h1, h2 {
font-weight: 300;
}
.left, .right{
width: 50%;
}
.left{
float: left;
}
.right {
float: right;
}