I am having trouble setting up containers for a website I am making.
I have defined the width of a sidebar container, but when I put text in it to test, it pushes down the body instead of sitting next to it..
My code is as follows
<div id="sidebar">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mattis urna at tristique tincidunt. Etiam ut cursus elit. Donec hendrerit turpis urna, ac pretium enim tincidunt nec. Donec ut mauris convallis odio vehicula dapibus ut id ante. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus a eleifend magna. Suspendisse potenti. Morbi ac ante vel sapien bibendum lacinia eu et nulla. Nunc aliquam nunc quis sem sollicitudin ultricies. Sed ultricies ornare nisi accumsan pharetra. Suspendisse elit arcu, sagittis vel bibendum eget, sollicitudin vel ipsum. Nam feugiat dolor tellus, sit amet adipiscing dui imperdiet at. Morbi facilisis non orci sit amet placerat. Nunc arcu elit, tincidunt vel est sit amet, fringilla porttitor leo. Nunc pharetra tellus vitae convallis elementum.<br>
Quisque tristique nunc semper feugiat lacinia. Cras eu nunc commodo, auctor augue sed, pellentesque nisi. Duis ut sapien non metus venenatis porta vitae ac turpis. Suspendisse et fringilla magna. Quisque tempus tortor metus, quis eleifend elit interdum mollis. Nullam porta tincidunt magna sed ullamcorper. In luctus purus at fermentum posuere. Donec pellentesque lectus lorem, at tempus turpis iaculis ac. Sed in eros vitae augue adipiscing vehicula. Vivamus arcu odio, cursus nec magna rhoncus, eleifend ornare sem.<br></p>
</div>
<div class="container">
<p class="body">
Everything Blinds is a ‘come-to-you’ blinds service operating on-site, so you don’t have to worry about the inconvenience of having your blinds taken away. As professional blind specialists, we have years of experience - we know how to fix and clean all makes and models, and our in-depth knowledge of blinds can help you choose the right new blind for your home. <br>
We aim for quality customer service by providing:
</p>
<ul>
<li>Free quotes for cleaning, repairing and installing old and new blinds</li>
<li>Most jobs can be easily quoted over the phone</li>
<li>Premium quality blinds at competitive prices</li>
<li>Onsite, on-the-day cleaning and repairing</li>
<li>Wide variety of Australian-made blinds</li>
<li>Reliable and friendly service</li>
</ul>
</div>
#sidebar {width: 20%;margin-left: 10%;}
.container {width: 60%; margin-left: 30%; margin-right: 10%;}
You can see it in action at www.dweeman.com/eb/sitetemplate.html
I used a predone template for the navigation menu which had a few CSS elements, but I can't spot anything that would be interfering.
Any ideas what I am missing? I know the website looks terrible and has problems but it's still in early development.
Thanks
Update your HTML and CSS as mentioned below :
HTML :
<div style="float: left">
<div id="sidebar">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mattis urna at tristique tincidunt. Etiam ut cursus elit. Donec hendrerit turpis urna, ac pretium enim tincidunt nec. Donec ut mauris convallis odio vehicula dapibus ut id ante. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus a eleifend magna. Suspendisse potenti. Morbi ac ante vel sapien bibendum lacinia eu et nulla. Nunc aliquam nunc quis sem sollicitudin ultricies. Sed ultricies ornare nisi accumsan pharetra. Suspendisse elit arcu, sagittis vel bibendum eget, sollicitudin vel ipsum. Nam feugiat dolor tellus, sit amet adipiscing dui imperdiet at. Morbi facilisis non orci sit amet placerat. Nunc arcu elit, tincidunt vel est sit amet, fringilla porttitor leo. Nunc pharetra tellus vitae convallis elementum.<br>
Quisque tristique nunc semper feugiat lacinia. Cras eu nunc commodo, auctor augue sed, pellentesque nisi. Duis ut sapien non metus venenatis porta vitae ac turpis. Suspendisse et fringilla magna. Quisque tempus tortor metus, quis eleifend elit interdum mollis. Nullam porta tincidunt magna sed ullamcorper. In luctus purus at fermentum posuere. Donec pellentesque lectus lorem, at tempus turpis iaculis ac. Sed in eros vitae augue adipiscing vehicula. Vivamus arcu odio, cursus nec magna rhoncus, eleifend ornare sem.<br>
</p>
</div>
<div class="container">
<p class="body">
Everything Blinds is a ‘come-to-you’ blinds service operating on-site, so you don’t have to worry about the inconvenience of having your blinds taken away. As professional blind specialists, we have years of experience - we know how to fix and clean all makes and models, and our in-depth knowledge of blinds can help you choose the right new blind for your home.
<br>
We aim for quality customer service by providing:
</p>
<ul>
<li>Free quotes for cleaning, repairing and installing old and new blinds</li>
<li>Most jobs can be easily quoted over the phone</li>
<li>Premium quality blinds at competitive prices</li>
<li>Onsite, on-the-day cleaning and repairing</li>
<li>Wide variety of Australian-made blinds</li>
<li>Reliable and friendly service</li>
</ul>
</div>
</div>
CSS :
#sidebar {
width: 20%;
margin-left: 10%;
float: left;
}
.container {
width: 60%;
float: left;
padding-left: 15px;
word-break: break-all;
}
You should use floats. try adding this to your sidebar and container..
#sidebar: {
float:left;
width: "";
height:auto;
}
and
#container {
float:left;
width:"";
}
Just make sure to fill the width with real values =)
Also make sure you are FTPing correctly. I don't see any floats on your page still =P
try adding this style overflow-wrap: break-word;
All you need to do is add float:left; to your sidebar:
#sidebar {
width: 20%;
margin-left: 10%;
float: left;
}
Related
I have a project in which I'm parsing some text and reformatting it with divs wrapped around key sections. I'm using divs because I specifically need to outdent the first line of each section, for which I'm using left-padding along with negative text-indent. Everything is working fine, except for one issue: due to the nature of the text and the way I need to parse it, many sections will need to end with a comma which cannot be included in the prior div. So I end up with a comma that floats on its own line. I'd like to find a way to make the comma stay with the prior div instead of appearing on a new line. Note: changing the parsing routine to move the comma inside the prior div will be complex; I'm specifically looking for a way to do this in CSS without moving the comma inside the prior div.
Here's a simplified example of the output of what my parse-to-html routine produces (JSFiddle):
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<style>
.inner {
padding-left: 8ch;
text-indent: -6ch;
}
</style>
</head>
<body>
<div class="container">
<div class="inner">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis leo diam. Donec mattis erat eget augue pellentesque sodales. Aliquam et augue eget libero mollis hendrerit eu a purus. Morbi bibendum, nunc eget lobortis porttitor, tortor velit posuere ex, at tempor eros orci auctor magna. Praesent maximus malesuada sodales. Integer convallis eget orci eget cursus</div>,
<div class="inner">Mauris aliquam luctus sem, non cursus libero cursus non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum dignissim nisi eu elit placerat, vel euismod quam elementum. Nam fringilla tristique nibh a mattis. Duis finibus lacus libero, quis efficitur sem egestas vitae. Nunc auctor enim lectus, non finibus est tincidunt ut. Nulla commodo odio ut nisl ullamcorper vehicula.</div>
</div>
</body>
</html>
If you view the rendered output, you'll see that between the two inner divs, there's a comma that appears on its own line. I'd like it at the end of the final line of the previous div. In order to get the outdenting, I need to use div instead of span. Is there any way to make that comma appear at the end of the prior div, without moving it inside the div?
Also: I'm targeting Electron.js, so I don't need an every-browser solution. Something that works in latest Chrome is sufficient.
Edit to add: if it helps, assume I can wrap additional tags around the content, including around the div + comma. It's moving the comma that is expensive (for my value of expensive).
It's not the cleanest solution, but since you can't put the comma in the div you will need to set the div to display as inline (or switch it to a span) so that the comma appears next to the text and handle the line break with wrapping the comma and adding a pseudo element. E.g.:
.container {
padding-left: 8ch;
}
.inner {
display: inline;
margin-left: -6ch;
}
.comma:after {
display: block;
content: " ";
}
See this update to your JS Fiddle for an example.
I have come with this solution for you if you don't want to change the HTML code at all!
CSS will add a comma after the div.inner while javaScript will remove the existing comma.
let comma = document.querySelectorAll('.inner');
for (let i = 0; i < comma.length; i++){
comma[i].nextSibling.textContent = '';
}
.inner {
padding-left: 8ch;
text-indent: -6ch;
margin-bottom:15px;/*adds extra space at bottom*/
}
.inner:after{
content: ",";
}
.inner:last-child::after{
content: "";
}
<div class="container">
<div class="inner">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis leo diam. Donec mattis erat eget augue pellentesque sodales. Aliquam et augue eget libero mollis hendrerit eu a purus. Morbi bibendum, nunc eget lobortis porttitor, tortor velit posuere ex, at tempor eros orci auctor magna. Praesent maximus malesuada sodales. Integer convallis eget orci eget cursus</div>,
<div class="inner">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis leo diam. Donec mattis erat eget augue pellentesque sodales. Aliquam et augue eget libero mollis hendrerit eu a purus. Morbi bibendum, nunc eget lobortis porttitor, tortor velit posuere ex, at tempor eros orci auctor magna. Praesent maximus malesuada sodales. Integer convallis eget orci eget cursus</div>,
<div class="inner">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis leo diam. Donec mattis erat eget augue pellentesque sodales. Aliquam et augue eget libero mollis hendrerit eu a purus. Morbi bibendum, nunc eget lobortis porttitor, tortor velit posuere ex, at tempor eros orci auctor magna. Praesent maximus malesuada sodales. Integer convallis eget orci eget cursus</div>,
<div class="inner">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis leo diam. Donec mattis erat eget augue pellentesque sodales. Aliquam et augue eget libero mollis hendrerit eu a purus. Morbi bibendum, nunc eget lobortis porttitor, tortor velit posuere ex, at tempor eros orci auctor magna. Praesent maximus malesuada sodales. Integer convallis eget orci eget cursus</div>,
<div class="inner">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam quis leo diam. Donec mattis erat eget augue pellentesque sodales. Aliquam et augue eget libero mollis hendrerit eu a purus. Morbi bibendum, nunc eget lobortis porttitor, tortor velit posuere ex, at tempor eros orci auctor magna. Praesent maximus malesuada sodales. Integer convallis eget orci eget cursus</div>,
<div class="inner">Mauris aliquam luctus sem, non cursus libero cursus non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum dignissim nisi eu elit placerat, vel euismod quam elementum. Nam fringilla tristique nibh a mattis. Duis finibus lacus libero, quis efficitur sem egestas vitae. Nunc auctor enim lectus, non finibus est tincidunt ut. Nulla commodo odio ut nisl ullamcorper vehicula.</div>
</div>
how can I create a x scrollable div?
The div should be placed to a fixed position?
With this code it does not scroll. I think it is because of fixed position.
.picdiv {
margin-top: 30px;
margin-left: 30px;
position: fixed;
top: 80;
width: 80%;
height: 60px;
display: inline-block;
white-space: nowrap;
overflow: hidden;
overflow-x: auto;
}
<div class="picdiv">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Bild_der_Wissenschaft_Logo.svg/400px-Bild_der_Wissenschaft_Logo.svg.png">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Bild_der_Wissenschaft_Logo.svg/400px-Bild_der_Wissenschaft_Logo.svg.png">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Bild_der_Wissenschaft_Logo.svg/400px-Bild_der_Wissenschaft_Logo.svg.png">
</div>
<div class="container">
<div class="col-md-12">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.
Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.
Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum.
Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla
mauris sit amet nibh. Donec sodales sagittis magna.</p>
</div>
</div>
Thanks for help
I cannot comment but your overflow-x is not working because images are going one under another and their width is under 80% of your .picdiv class which won't use scroll x if images are in line it will work..
I need to support >= IE9
Click Run code snippet... to see my two columns
main {
background-color: limegreen;
}
.row {
overflow: hidden;
border: 1px solid red;
margin-bottom: 15px;
}
section {
float: left;
margin: 0 2%;
width: 46%;
background-color: palegreen;
}
<main>
<div class="row">
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
</div>
<div class="row">
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
</div>
<main>
I would like the each <section> to have a matching vertical height. I'm not sure how to do this using CSS.
You can stick with float if you want, by using CSS pseudo elements + position tricks for the equal height background color, see the following snippet and comments inline.
jsfiddle
main {
background-color: limegreen;
}
.row {
overflow: hidden;
border: 1px solid red;
margin-bottom: 15px;
position: relative;
}
section {
float: left;
margin: 0 2%;
width: 46%;
background-color: palegreen;
position: relative;
z-index: 1; /* top of the pseudo elements */
}
.row:before, .row:after {
content: "";
position: absolute;
top: 0;
background: palegreen;
width: 46%; /* same as section width */
height: 100%;
}
.row:before {
left: 2%; /* left margin */
}
.row:after {
left: 52%; /* 2% + 46% + 2% + 2% */
}
<main>
<div class="row">
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
</div>
<div class="row">
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
</div>
</main>
Another approach would be CSS table + table-row + table-cell, like others already suggested in the comments above. I'm adding it here, plus the extra border-collapse + border-spacing features, for drawing the gaps. When comes to responsiveness or mobile style, you can simple reset the relevant display:table* properties back to display:block or so.
jsfiddle
main {
background-color: limegreen;
display: table;
border-collapse: separate;
table-layout: fixed;
border-spacing: 20px;
width: 100%;
}
.row {
display: table-row;
}
section {
display: table-cell;
vertical-align: top;
background: palegreen;
}
<main>
<div class="row">
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
</div>
<div class="row">
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
</div>
</main>
The outputs between the two solutions are slightly different, but mostly adjustable. One more thing on HTML syntax - the last <main> should be the closing </main>.
EDIT
Added table-layout:fixed for easy equal width of the columns, no matter how many of them.
just add display: flex; to container
main {
background-color: limegreen;
}
.row {
overflow: hidden;
border: 1px solid red;
margin-bottom: 15px;
display: flex;
}
section {
margin: 0 2%;
width: 46%;
background-color: palegreen;
}
<main>
<div class="row">
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
</div>
<div class="row">
<section>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras mattis consectetur purus sit amet fermentum. Maecenas faucibus mollis interdum.</p>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Nulla vitae elit libero, a pharetra augue. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
</section>
<section>
<p>Nulla vitae elit libero, a pharetra augue. Cras mattis consectetur purus sit amet fermentum.</p>
<p>Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</section>
</div>
<main>
If you want IE 9 support you can use Match Height JS
Given This markup
CSS
#wrapper {
width: 900px;
}
#column1 {
width: 320px;
float: left;
}
#column2 {
width: 570px;
float: left;
padding-left: 10px;
}
#social {
text-align: center
}
HTML
<div id="wrapper">
<div id="column1">
<div id="image">
<a href="http://stackoverflow.com">
<img width="320" src="http://appharbor.com/assets/images/stackoverflow-logo.png">
</a>
</div>
<div id="social">
Some Social Plugins/Buttons Whatever
</div>
</div>
<div id="column2">
<div>
SOME REALLY LONG CONTENT WHICH IS USER-GENERATED (Can't be styled or this structure of divs and br be expected)
</div>
<br />
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac ante ac dolor interdum tristique vitae sit amet erat. Quisque auctor sagittis augue, vitae eleifend nibh egestas quis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris condimentum varius orci, ac accumsan mauris viverra nec. Nunc ullamcorper dapibus velit, ac vehicula turpis placerat quis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
</div>
<br />
<div>
Vivamus quis sem lectus. Phasellus lobortis semper nulla, ut imperdiet neque aliquam at. In tincidunt, mauris quis condimentum tempor, tellus magna mollis magna, a laoreet purus metus id tellus. Proin sagittis, sapien a tristique consequat, tellus neque feugiat massa, vel vulputate ligula lectus nec enim. Aliquam erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
</div>
<br />
<div>
Suspendisse dapibus diam eu felis convallis sed iaculis lorem aliquam. Duis sit amet metus a lectus commodo sodales vel a lacus. Praesent auctor facilisis ligula vitae convallis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam mi leo, ultrices vitae consequat at, luctus in arcu. In tincidunt pellentesque ornare. Sed laoreet porta ante, at euismod ipsum volutpat facilisis. Donec at augue iaculis ligula interdum consequat vitae quis turpis. Donec pulvinar velit nec arcu eleifend faucibus. Praesent placerat magna eget ipsum iaculis nec condimentum nibh egestas. Donec massa tellus, porttitor vitae posuere sed, dapibus quis sapien. Sed elit est, dapibus sit amet pulvinar et, volutpat non quam. Aenean eget est tellus. Mauris at tincidunt dui.
</div>
<br />
<div>
SOME REALLY LONG CONTENT WHICH IS USER-GENERATED (Can't be styled or this structure of divs and br be expected)
</div>
</div>
</div>
Also Hosted At: http://jsfiddle.net/bbQPE/1/
Is It Possible to fill the space in column one with the text in column two?
PS: Without a fixed width and the float for column2 seems to be the answer but seems like a hack more than a pure-css solution or m i wrong.?
Remove floating form column2
#column2 {
width: 570px;
padding-left: 10px;}
I am trying put ads inside my blogger post & i want my data to wrap around the ads.I am using following code to make this happen.
Ex. Desired output.
.
<div style='float:right;margin:50px 0px 0px 0px;'>
<!-- AD1 Code -->
</div>
<data:post.body/>
<div style='float:left;margin:0px 0px 50px 0px;'>
<!-- AD2 Code -->
</div>
But i am not able to wrap the text around it & Second div sticks to the bottom without showing any data on the right side.
Is there any property which is left to be added apart from Float and margin.
EDIT: <data:post.body/> is the tag which fetches every blogger post content. so the data for the post come automatically. This code has to be added in the template so that it works for every post. I can't hard code the Div tags inside every post so i need some method to arrange ads around my post.
I can put the divs with the specified properties at the starting or ending of the <data:post.body/> tag.
Thanks.
You can try this :
<div style="text-align:justify">
<div
style="float:right;margin:5px;border:2px solid red;height:100px;width:100px">
Ad 1
</div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lobortis
ultrices felis, sed faucibus elit sollicitudin eu. Pellentesque habitant
morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Etiam id mi a elit luctus tristique. Curabitur pharetra magna ac nisi
accumsan a consequat magna placerat. Aliquam erat volutpat. Integer id
felis ante, et malesuada leo. Duis scelerisque vulputate lorem, at
cursus eros rutrum pulvinar.
Nunc tempus ultricies varius. Suspendisse interdum imperdiet enim, quis
aliquam sapien pulvinar in. Morbi vulputate euismod elit, ut ultricies
lectus dignissim at. Venenatis ullamcorper purus at consequat. Integer
ultricies, quam vitae fringilla venenatis, urna felis tincidunt turpis,
quis volutpat nisi felis tincidunt turpis. Proin at metus sit amet augue
convallis laoreet. Etiam viverra mollis ornare.
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
cubilia Curae; Pellentesque libero lectus, laoreet quis consectetur sit
amet, laoreet vel. Suspendisse commodo fringilla facilisis. Nam viverra
laoreet lorem, at molestie vestibulum non.
<div
style="float:left;margin:5px;border:2px solid red;height:100px;width:100px">
Ad 2
</div>
Etiam ut nulla justo. Quisque dignissim ultrices faucibus. Maecenas volutpat,
eros nec rutrum eleifend, enim dolor gravida nulla, quis vestibulum neque
dolor vel purus. Etiam imperdiet mollis magna, eget interdum eros tincidunt
quis.
Sed a ligula metus, ac ornare elit. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Suspendisse sit amet lacus felis.
Phasellus ultrices facilisis interdum. Morbi dapibus turpis a nisl mollis in
hendrerit quam luctus. Cras eleifend mauris eu lectus viverra ullamcorper.
In sed erat et lacus dapibus fermentum. Donec bibendum, eros ac convallis
fermentum, dolor justo tincidunt risus, vitae lacinia lorem risus eu ipsum.
Morbi fringilla ante ut ipsum blandit vehicula.
</div>
Preview : http://jsfiddle.net/Gs2kD/
The "clear" attribute can prevent any floaters at the same Y position as the element that it's on.
Check out Sandbag Float Pusher, and the other sandbags on css-lab.com. It uses a thin dummy floater on the same side to push the "ad" down to where you want it. The "ad" has "clear" set. This technique allows you to flow the content in without modification, as you require.
Google for css sandbag for more techniques.
You can put the ads inside the post with JavaScript, especially easy with jQuery for example.
The only thing you have to figure out, is how to find a good location for you ads, i.e. where to actually insert them in the code.