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!
Related
am new to Bulma and flex to be honest.
So i have the following code:
document.addEventListener('DOMContentLoaded', function () {
// Get all "navbar-burger" elements
var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Check if there are any nav burgers
if ($navbarBurgers.length > 0) {
// Add a click event on each of them
$navbarBurgers.forEach(function ($el) {
$el.addEventListener('click', function () {
// Get the target from the "data-target" attribute
var target = $el.dataset.target;
var $target = document.getElementById(target);
// Toggle the class on both the "navbar-burger" and the "navbar-menu"
$el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
});
#font-face {
font-family: Pacifico;
src: url(fonts/pacifico/Pacifico-Regular.ttf);
}
.pacifico {
font-family: Pacifico;
font-size:1.5em;
color:red;
}
.top_bg {background-image: url("https://png.pngtree.com/thumb_back/fw800/background/20200113/pngtree-ornate-cross-rhombus-repeating-symmetric-dark-blue-blue-and-white-tile-image_327096.jpg"); background-repeat:repeat-x;}
.top_bg div {height:125px;}
.bottom_bg {background-image: url("images/bg_bottom_repeat.jpeg"); background-repeat:repeat-x;}
// .bird { background-image: url("images/bird.png"); background-position: 50% 30%; background-attachment: inherit;}
.under {text-decoration:underline;}
.navbar-item.is-mega {
position: static;
.is-mega-menu-title {
margin-bottom: 0;
padding: .375rem 1rem;
}
}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>222</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma#0.9.4/css/bulma.min.css">
</head>
<body>
<div class="columns is-mobile is-centered is-vcentered top_bg mt-0 mb-0">
<div class="column is-mobile pt-0 is-narrow"><img src="https://www.aiesec.in/wp-content/uploads/2018/08/Captain-america-1.jpg" style="height:125px"></div>
<div class="column has-text-centered"><span class="pacifico"><nobr>God save the Queen</nobr></span></div>
</div>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">1</a>
<a class="navbar-item">2</a>
<a class="navbar-item">3</a>
</div>
</div>
</nav>
<div class="columns mt-0 pt-0 mb-5">
<div class="column"></div>
<div class="column is-three-quarters"><img src="https://static.educalingo.com/img/en/800/african-elephant.jpg" class="box mr-5 is-pulled-left" style="width:20%;">
<p class="mb-3">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce dictum ullamcorper felis, nec maximus est suscipit nec. Proin vulputate rutrum metus id mattis. Proin eget sapien lacus. Phasellus a elit ante. Donec accumsan vel elit id malesuada. Sed et cursus massa. Nullam feugiat iaculis laoreet.</p>
<p class="mb-3">Curabitur tristique interdum luctus. Proin rutrum augue ac porta aliquet. Suspendisse quis iaculis dolor. Sed nec arcu sapien. Phasellus vitae convallis risus. Donec vel consectetur nulla, aliquet lacinia leo. Nullam vitae mauris dolor. Etiam ac malesuada tellus, id lacinia felis. Fusce ut turpis metus. Maecenas in interdum nulla. Quisque faucibus vitae est ut euismod. Nullam eu lorem elementum, tempor felis quis, maximus sem. Sed at ipsum fringilla, cursus nunc sed, ullamcorper elit. Aenean eget tortor quam.</p>
<p class="mb-3">Aliquam id ex efficitur quam faucibus bibendum a quis augue. Suspendisse potenti. Maecenas neque lectus, sagittis vitae porta quis, consequat vel lorem. Aliquam vitae gravida justo. Aliquam at orci eget magna scelerisque lacinia. Mauris ornare tincidunt suscipit. Fusce scelerisque erat sit amet dui mattis facilisis. Etiam nec lectus rutrum, viverra purus ultricies, ullamcorper eros.</p>
<p class="mb-3">Suspendisse elementum justo ut enim imperdiet ultricies. Sed non dolor tincidunt, cursus nunc sed, fringilla ligula. Duis a commodo nulla. Fusce vulputate molestie porta. Pellentesque at ligula orci. Proin hendrerit commodo finibus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque eleifend gravida libero, sed bibendum sem pulvinar vitae.</p>
<p class="mb-3">Fusce sapien nulla, hendrerit et congue quis, hendrerit sit amet risus. Ut dignissim sodales nunc, sit amet viverra libero sagittis quis. Ut porta porta dolor, non aliquet massa faucibus id. Sed faucibus mollis mollis. Curabitur scelerisque lorem dolor, vitae aliquet magna aliquam vitae. Suspendisse est lorem, feugiat sit amet leo nec, vestibulum convallis quam. Praesent vitae arcu dapibus, euismod augue quis, bibendum ligula. Vestibulum quis eros dui. Donec pharetra sapien ligula, vel egestas est ornare ut. Suspendisse hendrerit, velit ut fringilla bibendum, velit elit congue neque, id rhoncus risus sapien vel ligula. Donec laoreet faucibus nulla, sed varius erat tincidunt sed. Donec vitae mi magna. Maecenas mollis facilisis tellus id convallis. Quisque sit amet egestas erat, tincidunt pretium metus. In hac habitasse platea dictumst. Nulla non laoreet lacus.</p>
</div>
<div class="column"></div>
</div>
</body>
The first question is how to center vertical text "God save the queen"? I've tried native Bulma classes as is-vcentered but no suсcess.
Second one - if my page is resized to a small mobile- size 2 columns that makes spaces at left / right in main section total disappear with no space left at all . Is there any build in classes for min-width or so?
We'll be appreciate for any kind of help.
I would like to hide the default checkbox from my light/darkmode toggle featured on my Wordpress blog. (Using single.php)
I inspected the code using the console and adjusted the CSS using the code below in the preview which worked.
However, when I saved and ran it properly, I didn't get the same outcome.
input[type=checkbox], input[type=radio] {
box-sizing: border-box;
padding: 0;
display: none !important;
}
<section id="blog-post">
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-10">
<div class="checkbox mt-3 text-right">
<input type="checkbox" id="darkSwitch">
<label for="darkSwitch"><i class="far fa-lightbulb fa-lg"><i>Light switch</i></i></label>
</div>
<div class="row my-5 justify-content-center">
<div class="col-sm-12 col-md-10 col-lg-8 mt-3">
<h2 class="subheader mt-3">Lorem Ipsum Dolor Amet.</h2>
<div class="dropcap">
<pre></pre>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <em>This is italic text</em>, <strong>this is bold text</strong>, <em><strong>this is bold italic</strong></em> text. Donec justo massa, imperdiet ac efficitur sit amet, pretium a nunc. Aliquam sem nisi, sagittis a lacus ut, pulvinar molestie magna. Nam aliquam tincidunt erat nec pulvinar. Nullam urna nunc, cursus nec pharetra eu, euismod id dolor. Duis imperdiet, ante iaculis suscipit pharetra, mauris neque ultricies lacus, tincidunt posuere lectus ipsum ac est. Donec odio nunc, feugiat nec mi eget, faucibus euismod urna. Donec pretium sit amet leo eget auctor. Nulla consequat metus at ullamcorper faucibus. Donec ultricies tristique velit sit amet commodo. Morbi bibendum, nulla ut aliquam bibendum, ex lacus lacinia dui, quis sagittis justo neque vel mauris. Phasellus varius dapibus sapien, et euismod turpis. Praesent elit metus, posuere nec ipsum eget, ultricies lobortis massa.</p>
<p>Quisque ornare libero id nibh imperdiet ultrices. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc fringilla urna in mauris consequat, eget lobortis elit sodales. Curabitur ipsum ligula, tincidunt eu venenatis quis, ullamcorper et nunc. Sed in hendrerit felis, eu fermentum mauris. In varius non urna at ullamcorper. Duis at arcu nibh. Vivamus et elementum purus. Nulla a tellus dapibus, tristique libero ut, porta odio. Nulla luctus aliquet tempus. Pellentesque ultrices finibus turpis, non vestibulum metus.</p>
Try the following css rules instead:
input[type='checkbox'], input[type='radio'] {
display: none !important;
visibility: hidden !important;
}
I have the following HTML layout:
<div class="parent">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>
The number of children and their heights can vary. Is it possible to style the parent element to divide the children into two columns, such that the parent takes the minimum possible height?
.parent {
display: flex;
flex-flow: column wrap;
margin: 0 -5px;
width: 500px;
height: 1500px; /* I want to remove this */
}
.child {
margin: 0 5px 10px;
width: 50%;
background: #f2f2f2;
border: 1px #ccc solid;
padding: 20px;
}
<div class="parent">
<div class="child">
<h3>Heading 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et nunc gravida, bibendum magna ut, rutrum dui. Vivamus pulvinar, tellus at tempor imperdiet, elit lectus eleifend dui, in molestie nisi mauris at sem. Nulla varius sapien ipsum, sed semper
nisl lacinia vel. Maecenas aliquet, ante eu feugiat iaculis, massa diam tincidunt est, id ornare nisi massa nec arcu. Nunc porta leo at diam aliquam eleifend. Cras vel diam dignissim, egestas lacus in, egestas ipsum. Aliquam ultricies justo et magna
dignissim auctor.</p>
</div>
<div class="child">
<h3>Heading 2</h3>
<p>Nam scelerisque hendrerit efficitur. Fusce quam mi, viverra ut enim sit amet, viverra dignissim tortor. Quisque laoreet eros sit amet ex rutrum pharetra. </p>
</div>
<div class="child">
<h3>Heading 3</h3>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi tortor orci, hendrerit vel diam et, rhoncus pellentesque quam. Donec nec porttitor urna. Nam interdum a tellus in bibendum. Etiam ac ultricies elit.
</p>
</div>
<div class="child">
<h3>Heading 4</h3>
<p>Morbi quis tortor interdum, ornare nibh interdum, maximus quam. Praesent elit urna, sodales sed mollis in, euismod quis ex. Maecenas nec tellus eu lectus varius placerat sed id eros. Donec imperdiet vulputate neque at varius. Sed nunc mauris, pretium
pretium fringilla ut, consequat sit amet ligula. Aliquam velit odio, pharetra at tincidunt ut, interdum ut augue. Mauris ultrices, mi et congue accumsan, tellus nisl semper justo, ut consectetur purus tellus ut ipsum. Suspendisse a neque eros. Suspendisse
sit amet lacus id tortor porta lobortis. Nam tincidunt, sem id porta congue, lectus dui iaculis enim, ac tristique erat mauris et mauris. Praesent neque mi, semper ornare ullamcorper eget, commodo a mauris. Curabitur sed commodo diam, a ullamcorper
quam.</p>
</div>
<div class="child">
<h3>Heading 5</h3>
<p>Sed sit amet sem metus. Pellentesque id rhoncus felis, nec condimentum ligula. Aliquam porta erat sapien, ac efficitur nisi blandit a. Nulla congue urna ac nisi tempor ultrices. Nunc eget risus ut tortor iaculis facilisis.</p>
</div>
<div class="child">
<h3>Heading 6</h3>
<p>Fusce malesuada et magna eu dapibus. Vivamus aliquam venenatis libero, quis lobortis ante luctus nec. Nullam vel lectus justo. Etiam diam turpis, auctor in finibus eget, eleifend vel ex. Curabitur sit amet neque ex. Nulla dapibus placerat tortor,
ac viverra arcu finibus mattis. Donec vel sem urna. Phasellus pretium ultricies ipsum, eu mollis magna rutrum sed. Mauris varius accumsan diam, a aliquet nibh tincidunt ac. Proin lobortis nunc eget enim pharetra, eu lobortis nisi placerat. Aliquam
enim tortor, viverra non posuere ut, dapibus sed elit.</p>
</div>
<div class="child">
<h3>Heading 7</h3>
<p>Sed molestie congue lacinia. Proin cursus laoreet magna, a pharetra odio consequat et. Donec et ullamcorper massa. Fusce eu dapibus felis. Cras condimentum purus et eros finibus aliquam. In hac habitasse platea dictumst. Sed sit amet sem metus. Pellentesque
id rhoncus felis, nec condimentum ligula. Aliquam porta erat sapien, ac efficitur nisi blandit a. Nulla congue urna ac nisi tempor ultrices. Nunc eget risus ut tortor iaculis facilisis.</p>
</div>
</div>
http://codepen.io/anon/pen/NqLYjE
In the above example, I was able to achieve the two column layout by setting height for the parent element. I want to do it without setting the height. Is it possible?
Setting flex-direction to row is ugly, as there will be whitespace between two vertical child elements when the height of children on a single row are unequal.
I believe you need the column propertie and not the flex model.
forked pen
.parent {
-moz-column-count:2;
column-count:2;
-moz-column-gap:0;
column-gap:0;
margin: 0 -5px;
width: 500px;
}
.child {
margin: 0 5px 10px;
background: #f2f2f2;
border: 1px #ccc solid;
padding: 20px;
}
<div class="parent">
<div class="child">
<h3>Heading 1</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et nunc gravida, bibendum magna ut, rutrum dui. Vivamus pulvinar, tellus at tempor imperdiet, elit lectus eleifend dui, in molestie nisi mauris at sem. Nulla varius sapien ipsum, sed semper
nisl lacinia vel. Maecenas aliquet, ante eu feugiat iaculis, massa diam tincidunt est, id ornare nisi massa nec arcu. Nunc porta leo at diam aliquam eleifend. Cras vel diam dignissim, egestas lacus in, egestas ipsum. Aliquam ultricies justo et magna
dignissim auctor.</p>
</div>
<div class="child">
<h3>Heading 2</h3>
<p>Nam scelerisque hendrerit efficitur. Fusce quam mi, viverra ut enim sit amet, viverra dignissim tortor. Quisque laoreet eros sit amet ex rutrum pharetra. </p>
</div>
<div class="child">
<h3>Heading 3</h3>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi tortor orci, hendrerit vel diam et, rhoncus pellentesque quam. Donec nec porttitor urna. Nam interdum a tellus in bibendum. Etiam ac ultricies elit.
</p>
</div>
<div class="child">
<h3>Heading 4</h3>
<p>Morbi quis tortor interdum, ornare nibh interdum, maximus quam. Praesent elit urna, sodales sed mollis in, euismod quis ex. Maecenas nec tellus eu lectus varius placerat sed id eros. Donec imperdiet vulputate neque at varius. Sed nunc mauris, pretium
pretium fringilla ut, consequat sit amet ligula. Aliquam velit odio, pharetra at tincidunt ut, interdum ut augue. Mauris ultrices, mi et congue accumsan, tellus nisl semper justo, ut consectetur purus tellus ut ipsum. Suspendisse a neque eros. Suspendisse
sit amet lacus id tortor porta lobortis. Nam tincidunt, sem id porta congue, lectus dui iaculis enim, ac tristique erat mauris et mauris. Praesent neque mi, semper ornare ullamcorper eget, commodo a mauris. Curabitur sed commodo diam, a ullamcorper
quam.</p>
</div>
<div class="child">
<h3>Heading 5</h3>
<p>Sed sit amet sem metus. Pellentesque id rhoncus felis, nec condimentum ligula. Aliquam porta erat sapien, ac efficitur nisi blandit a. Nulla congue urna ac nisi tempor ultrices. Nunc eget risus ut tortor iaculis facilisis.</p>
</div>
<div class="child">
<h3>Heading 6</h3>
<p>Fusce malesuada et magna eu dapibus. Vivamus aliquam venenatis libero, quis lobortis ante luctus nec. Nullam vel lectus justo. Etiam diam turpis, auctor in finibus eget, eleifend vel ex. Curabitur sit amet neque ex. Nulla dapibus placerat tortor,
ac viverra arcu finibus mattis. Donec vel sem urna. Phasellus pretium ultricies ipsum, eu mollis magna rutrum sed. Mauris varius accumsan diam, a aliquet nibh tincidunt ac. Proin lobortis nunc eget enim pharetra, eu lobortis nisi placerat. Aliquam
enim tortor, viverra non posuere ut, dapibus sed elit.</p>
</div>
<div class="child">
<h3>Heading 7</h3>
<p>Sed molestie congue lacinia. Proin cursus laoreet magna, a pharetra odio consequat et. Donec et ullamcorper massa. Fusce eu dapibus felis. Cras condimentum purus et eros finibus aliquam. In hac habitasse platea dictumst. Sed sit amet sem metus. Pellentesque
id rhoncus felis, nec condimentum ligula. Aliquam porta erat sapien, ac efficitur nisi blandit a. Nulla congue urna ac nisi tempor ultrices. Nunc eget risus ut tortor iaculis facilisis.</p>
</div>
</div>
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>
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.