Hide a div when hovering over another div - css

I've written CSS that should hide the container div in the middle of the page, when the list div on the left is hovered over.
I've got a feeling that giving the container div a fixed position is causing this, but I'm not quite sure. The code seems correct.
Html
<section class="container">
<div class="description">
<h2>Writer</h2>
<p>Lorem ipsum dolor sit amet, suspendisse nam habitasse pellentesque arcu quae dignissim, amet magna diam aenean. Amet ipsum aenean, massa posuere maecenas nam lectus nibh lacus, nisl lacus magna nullam leo quis. Mi elit ante nunc, mi odio congue rhoncus dui quis dictum, lectus eleifend aliquam sed venenatis vitae lorem, potenti non dictum sit. Condimentum nonummy vitae tristique, pede nullam pretium arcu vestibulum dictum</p>
<p>Lorem ipsum dolor sit amet, suspendisse nam habitasse pellentesque arcu quae dignissim, amet magna diam aenean. Amet ipsum aenean, massa posuere maecenas nam lectus nibh lacus, nisl lacus magna nullam leo quis.</p>
</div>
</section>
<div class="list">
<ul class="projectList">
<li class="projectImage">Philomena Kwao<span><img src="helene images/philomena.jpg" alt="" height="" width="" /></span></li>
</ul>
</div>
<div>
css
.container {
position:absolute;
justify-content:center;
align-items:center;
box-sizing:border-box;
display:flex;
width:500px;
left:325px;
align-content:space-around;
}
.list {
width:325px;
margin: 20px 30px 20px 0;
box-sizing:bordr-box;
overflow-x:hidden;
}
ul {
list-style-type:none;
margin:0;
padding:0
}
.projectImage img {
display:none;
}
.list .projectImage:hover img {
display: block;
margin: 0;
top: 20%;
left: 50%;
transform: translate(-50%);
position: absolute;
display: block;
/* width: 100%;
height: 100%; */
}
.list:hover + section.container {
display: none;
}

.list:hover + section.container would only work if .list would be the preceding sibling of section.container. But your section.container is placed before .list.
The only way to make it work is to place .list before section.container. To display section besides .list, I used float: left; on .list.
Working example: https://codepen.io/anon/pen/PmJZgm?editors=1100
Note 1: you might have to tweak the margins/paddings a bit.
Note 2: If you place any content after section, when hiding it the rest of the content will jump up. If you don't want this, you probably want to try
.list:hover + section.container {
opacity: 0;
}

If you move .list before .container, your selector will work. I added a parent element (main) to .list and .container and used flex on the parent instead of using position: absolute on .container to get it beside .list.
#helene, body, html {
width:100%
}
body {
background-color:#FFFAF1;
}
#site {
height:100%;
width:100%;
box-sizing:border-box;
vertical-align:middle;
overflow:hidden;
display:block;
}
.title {
position:fixed:
z-index:10;
text-align:center;
}
.container {
justify-content:center;
align-items:center;
box-sizing:border-box;
display:flex;
flex: 0 0 500px;
align-content:space-around;
}
.list {
flex: 0 0 325px;
margin: 20px 30px 20px 0;
box-sizing:bordr-box;
overflow-x:hidden;
}
ul {
list-style-type:none;
margin:0;
padding:0
}
.projectImage img {
display:none;
}
.list .projectImage:hover img {
display: block;
margin: 0;
top: 20%;
left: 50%;
transform: translate(-50%);
position: absolute;
display: block;
/* width: 100%;
height: 100%; */
}
.list:hover + section.container {
display: none;
}
main {
display: flex;
}
<div id="helene">
<div id="site">
<header class="title">
<h1> Helene Selam Kleih</h1>
</header>
<main>
<div class="list">
<h2>In Conversation With-</h2>
<ul class="projectList">
<li class="projectImage">Philomena Kwao<span><img src="helene images/philomena.jpg" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
</ul>
<h2>Articles - </h2>
<ul class="projectList">
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
<li class="projectImage">Philomena Kwao<span><img src="" alt="" height="" width="" /></span></li>
</ul>
</div>
<section class="container">
<div class="description">
<h2>Writer</h2>
<p>Lorem ipsum dolor sit amet, suspendisse nam habitasse pellentesque arcu quae dignissim, amet magna diam aenean. Amet ipsum aenean, massa posuere maecenas nam lectus nibh lacus, nisl lacus magna nullam leo quis. Mi elit ante nunc, mi odio congue
rhoncus dui quis dictum, lectus eleifend aliquam sed venenatis vitae lorem, potenti non dictum sit. Condimentum nonummy vitae tristique, pede nullam pretium arcu vestibulum dictum</p>
<p>Lorem ipsum dolor sit amet, suspendisse nam habitasse pellentesque arcu quae dignissim, amet magna diam aenean. Amet ipsum aenean, massa posuere maecenas nam lectus nibh lacus, nisl lacus magna nullam leo quis.</p>
</div>
</section>
</main>
</div>
</div>

Related

break-after: avoid; equivalent in flex

I'm trying to make some kind of dictionary with flex. My elements are added from top to bottom then left to right (the flex element .dictionary grows on the right instead of the bottom. My .dic-entry entries stay coherent/together because they are each wrapped in an <article> tag. However, between them, there are "letter titles" .dic-letter-title and they should stay together with the next .dic-entry.
In a column layout I would do break-after: avoid, how could I achieve this effect with flex elements?
IMPORTANT EDIT: To clarify, I'm able to circumvent the problem and make the result look exactly as I want. However I'm looking for a semantically-correct solution. Not one where I have to wrap two element together with a meaningless element for example.
EDIT: As #Nisha suggested in the comment I could wrap .dic-letter-title and the first .dic-entry in a container, however I'd like to avoid doing that as it is not semantically correct. If I wanted to add a semantically-correct container, it would have to be around all the dic-entry sharing the same first letter, but then they would form a bloc and I don't want that either.
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%
}
body, main, article {
display: flex;
flex-flow: column;
}
main {
flex: 1 0 100%;
}
main, .container {
min-height: 0;
}
.dictionary {
display: flex;
flex-flow: column wrap;
align-content: flex-start;
overflow-x: scroll;
}
.dic-letter-title {
/* DEBUG: This isn't working */
break-after: avoid;
color: red;
}
.dic-entry, .dic-entry * {
display: block;
padding: 0;
}
.dic-entry * {
margin: 0;
}
.dic-entry {
width: 16ch;
padding: 0 2.5em 1.5em 0;
}
<article class="container">
<section class="dictionary small-text">
<h3 class="dic-letter-title">Aa</h3>
<article class="dic-entry"><h4>Aliquam consequat</h4>
<p>Aliquam consequat vestibulum magna nec consequat.</p></article>
<article class="dic-entry"><h4>Aliquam fermentum</h4>
<p>Aliquam fermentum quis arcu vitae maximus.</p></article>
<h3 class="dic-letter-title">Ll</h3>
<article class="dic-entry"><h4>Lorem ipsum</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p></article>
<h3 class="dic-letter-title">Mm</h3>
<article class="dic-entry"><h4>Mauris blandit</h4>
<p>Mauris blandit, enim a aliquam convallis, felis turpis ultricies dolor, in blandit velit lorem at nulla.</p></article>
<h3 class="dic-letter-title">Pp</h3>
<article class="dic-entry"><h4>Pellentesque habitant</h4>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p></article>
<article class="dic-entry"><h4>Phasellus</h4>
<p>Phasellus in bibendum nisi.</p></article>
<h3 class="dic-letter-title">Uu</h3>
<article class="dic-entry"><h4>Quisque nec eros</h4>
<p>Quisque nec eros quis orci venenatis porttitor vitae sed nunc.</p></article>
<h3 class="dic-letter-title">Uu</h3>
<article class="dic-entry"><h4>Sed vulputate</h4>
<p>Sed vulputate id orci sed maximus.</p></article>
</section>
</article>
EDIT: I tried #zangab's solution of using list which mases sense semantically. However, now the "letter-group" title is solidary with what comes next, however now it's the whole letter-group can't wrap because the li can't be broken.
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%
}
body, main, article, .disc-entry {
display: flex;
flex-flow: column;
}
main {
flex: 1 0 100%;
}
main, .container {
min-height: 0;
}
.dictionary {
display: flex;
flex-flow: column wrap;
align-content: flex-start;
overflow-x: scroll;
}
.dictionary li {
list-style-type: none;
}
.dic-letter-title {
/* DEBUG: This isn't working */
break-after: avoid;
color: red;
}
.dic-entry, .dic-entry * {
display: block;
padding: 0;
}
.dic-entry * {
margin: 0;
}
.dic-entry {
width: 16ch;
padding: 0 2.5em 1.5em 0;
}
<article class="container">
<ul class="dictionary small-text">
<li class="dic-letter">
<h3 class="dic-letter-title">Aa</h3>
<ul>
<li class="dic-entry">
<h4>Aliquam consequat</h4>
<p>Aliquam consequat vestibulum magna nec consequat.</p>
</li>
<li class="dic-entry">
<h4>Aliquam fermentum</h4>
<p>Aliquam fermentum quis arcu vitae maximus.</p>
</li>
</ul>
</li>
<li class="dic-letter">
<h3 class="dic-letter-title">Ll</h3>
<ul>
<li class="dic-entry">
<h4>Lorem ipsum</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</li>
</ul>
</li>
<li class="dic-letter">
<h3 class="dic-letter-title">Mm</h3>
<ul>
<li class="dic-entry">
<h4>Mauris blandit</h4>
<p>Mauris blandit, enim a aliquam convallis, felis turpis ultricies dolor, in blandit velit lorem at nulla.</p>
</li>
</ul>
</li>
<li class="dic-letter">
<h3 class="dic-letter-title">Pp</h3>
<ul>
<li class="dic-entry">
<h4>Pellentesque habitant</h4>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</li>
<li class="dic-entry">
<h4>Phasellus</h4>
<p>Phasellus in bibendum nisi.</p>
</li>
</ul>
</li>
<li class="dic-letter">
<h3 class="dic-letter-title">Qq</h3>
<ul>
<li class="dic-entry">
<h4>Quisque nec eros</h4>
<p>Quisque nec eros quis orci venenatis porttitor vitae sed nunc.</p>
</li>
</ul>
</li>
<li class="dic-letter">
<h3 class="dic-letter-title">Uu</h3>
<ul>
<li class="dic-entry">
<h4>Sed vulputate</h4>
<p>Sed vulputate id orci sed maximus.</p>
</li>
</ul>
</li>
</ul>
</article>
have a look here:
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%
}
body, main, article {
display: flex;
flex-flow: column;
}
main {
flex: 1 0 100%;
}
main, .container {
min-height: 0;
}
.dictionary {
display: flex;
flex-flow: column wrap;
align-content: flex-start;
overflow-x: scroll;
list-style-type: none;
}
.dic-letter-title {
color: red;
}
.dic-entry, .dic-entry * {
display: block;
padding: 0;
}
.dic-entry * {
margin: 0;
}
.dic-entry {
width: 16ch;
padding: 0 2.5em 1.5em 0;
}
<article class="container">
<ul class="dictionary small-text">
<li>
<h3 class="dic-letter-title">Aa</h3>
<article class="dic-entry">
<h4>Aliquam consequat</h4>
<p>Aliquam consequat vestibulum magna nec consequat.</p>
</article>
<article class="dic-entry">
<h4>Aliquam fermentum</h4>
<p>Aliquam fermentum quis arcu vitae maximus.</p>
</article>
</li>
<li>
<h3 class="dic-letter-title">Ll</h3>
<article class="dic-entry">
<h4>Lorem ipsum</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</article>
</li>
<li>
<h3 class="dic-letter-title">Mm</h3>
<article class="dic-entry">
<h4>Mauris blandit</h4>
<p>Mauris blandit, enim a aliquam convallis, felis turpis ultricies dolor, in blandit velit lorem at nulla.
</p>
</article>
<li>
<h3 class="dic-letter-title">Pp</h3>
<article class="dic-entry"><h4>Pellentesque habitant</h4>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p></article>
<article class="dic-entry"><h4>Phasellus</h4>
<p>Phasellus in bibendum nisi.</p></article></li>
<li>
<h3 class="dic-letter-title">Uu</h3>
<article class="dic-entry"><h4>Quisque nec eros</h4>
<p>Quisque nec eros quis orci venenatis porttitor vitae sed nunc.</p></article></li>
<li>
<h3 class="dic-letter-title">Uu</h3>
<article class="dic-entry"><h4>Sed vulputate</h4>
<p>Sed vulputate id orci sed maximus.</p></article></li>
</ul>
</article>

CSS: On hover hide div and show image at the same time?

A similar question has been asked but it didn't provide a solution for my issue. CSS: On hover show and hide different div's at the same time?
I want to hide a div and display an image in the center of the page at the same time when I hover over my list items.
I tried this but it the second div in the middle of the page still shows on hover.
/* absorbing paddings within the div's width, instead of adding it
on top */
* {
box-sizing: border-box;
}
#container {
width: 100%;
}
header {
padding-top: 10px;
}
h1 {
text-align: center;
font-size: 150%;
}
.a {
width: 7%;
height: 48px;
}
.b {
width: 45%;
height: 48px;
}
.a,
.b {
display: inline-block;
vertical-align: top;
padding: 5px;
padding-top: 10px;
margin: 5px;
margin-right: 195px;
}
.a,
ul {
list-style: none;
line-height: 150%;
padding-top: 15px
}
li a {
text-decoration: none;
color: inherit;
}
.b,
h2 {
text-align: center;
}
.projectImage {
display: none;
}
.a:hover .projectImage {
display: block;
}
.a:hover .b {
display: none;
}
.a,
.image1:hover .projectImage {}
<div id="container">
<header id="title">
<h1>Lorem Ipsum</h1>
</header>
<div class="a">
<ul class="projectList">
<li class="projectImage">Project<span><img class="image1" src="" alt="" height="" /></span></li>
<li>Project<span><img src="" alt="" height="" /></span></li>
<li>Project<span><img src="" alt="" height="" /></span></li>
<li>Project<span><img src="" alt="" height="" /></span></li>
<li>Project<span><img src="" alt="" height="" /></span></li>
<li>Project<span><img src="" alt="" height="" /></span></li>
<li>Project<span><img src="" alt="" height="" /></span></li>
</ul>
</div>
<div class="b">
<h2>lorem ipsum</h2>
<p>Lorem ipsum dolor sit amet, suspendisse nam habitasse pellentesque arcu quae dignissim, amet magna diam aenean. Amet ipsum aenean, massa posuere maecenas nam lectus nibh lacus, nisl lacus magna nullam leo quis. Mi elit ante nunc, mi odio congue rhoncus
dui quis dictum, lectus eleifend aliquam sed venenatis vitae lorem, potenti non dictum sit. Condimentum nonummy vitae tristique, pede nullam pretium arcu vestibulum dictum, urna erat aliquam duis sit pede nam. Morbi mauris fermentum luctus morbi
nec eget, vitae fermentum et maecenas, primis ullamcorper mauris et diam nunc, turpis massa sit felis nullam.</p>
<p>Interdum morbi pellentesque. Et semper diam vestibulum, nisl est, porttitor mauris tellus hac, ut dictum massa. Elementum malesuada curabitur non euismod arcu, sit justo suspendisse aliquam purus suspendisse. Felis est leo, quis turpis ornare quis
tellus, fusce neque ut vitae justo penatibus molestie, per labore suscipit corrupti, non sed in id amet velit. Tempor rutrum tristique anim orci massa, arcu dolor eros dictum arcu.</p>
</div>
</div>
https://codepen.io/jordan_miguel/pen/dWNbzL?editors=1100
Since element .a and element .b are right next to each other in the markup you have supplied, you probably want to use the sibling selector to target element .b. Simply change your last declaration block to:
.a:hover + .b {
display: none;
}
Here's an updated Codepen.
Hope this helps! Let me know if you have any questions.

bootstrap container-fluid carousel

I'm quiet surprise I thought the use of container-fluid will give me a full width carousel but it didn't. It has a padding right and left of 15 px so i add a new class remove-padding in order to have no padding but it didn't work.
Any idea for having a carousel without padding ?
$(document).ready(function(){
$('.slick-carousel').slick({
arrows:true,
prevArrow:'<a class="slick-prev"><span class="glyphicon glyphicon-chevron-left"></span></a>',
nextArrow:'<a class="slick-next"><span class="glyphicon glyphicon-chevron-right"></span></a>'
});
});
.slick-prev {
left: 50px;
}
.slick-next {
right: 50px;
}
.slick-prev, .slick-next {
background: none;
border: medium none;
color: blue;
cursor: pointer;
display: block;
font-size: 24px;
height: 20px;
line-height: 0;
margin-top: -10px;
outline: medium none;
padding: 0;
position: absolute;
top: 50%;
width: 20px;
}
.slick-prev:before {
content: "";
}
.slick-next:before {
content: "";
}
.slick-prev:hover, .slick-prev:focus, .slick-next:hover, .slick-next:focus { color: #fff; }
.slick-carousel h1{ position:absolute; top:40px; left:20%; color:#fff; }*/
.remove-padding {padding-left: 0 !important; padding-right: 0 !important; margin-left: 0 !important; margin-right: 0 !important;}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="http://sandbox.jsnegley.net/jquery/slick-carousel/slick.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<link href="http://sandbox.jsnegley.net/jquery/slick-carousel/slick.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-12 pen">
<div class="page-header">
<h5>Slick Carousel</h5>
<h1>Basic Carousel</h1>
<ul class="technology">
<li>Bootstrap <span class="label label-default">3.3.4</span></li>
<li>jQuery <span class="label label-default">2.1.3</span></li>
<li>
<span class="glyphicon glyphicon-book"></span> Documentation
</li>
</ul>
</div>
</div>
</div>
<!-- /container --></div>
<div class="container-fluid remove-padding">
<!-- START MOD -->
<div class="slick-carousel">
<div><img src="http://sandbox.jsnegley.net/pics/carousel-1.jpg" class="img-responsive">
<h1>Title 1</h1>
</div>
<div><img src="http://sandbox.jsnegley.net/pics/carousel-2.jpg" class="img-responsive">
<h1>Very long crazy long mega long title</h1>
</div>
<div><img src="http://sandbox.jsnegley.net/pics/carousel-3.jpg" class="img-responsive"><h1>Title Title title</h1></div>
</div>
<!-- END MOD -->
</div>
<!-- /container --></div>
<div class="container"><div class="row">
<div class="col-xs-4">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lobortis est eget tristique vestibulum. Fusce et pulvinar erat, id viverra sem. Vivamus porttitor, sapien nec mattis fermentum, sem augue ornare erat, vitae interdum ante sapien id libero. Vestibulum luctus augue pretium purus posuere.
</div>
<div class="col-xs-4">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lobortis est eget tristique vestibulum. Fusce et pulvinar erat, id viverra sem. Vivamus porttitor, sapien nec mattis fermentum, sem augue ornare erat, vitae interdum ante sapien id libero. Vestibulum luctus augue pretium purus posuere.
</div>
<div class="col-xs-4">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lobortis est eget tristique vestibulum. Fusce et pulvinar erat, id viverra sem. Vivamus porttitor, sapien nec mattis fermentum, sem augue ornare erat, vitae interdum ante sapien id libero. Vestibulum luctus augue pretium purus posuere.
</div>
</div></div>
Add class row next to class slick-carousel.
This fixed the problem.
Some explanation:
.container-fluid adds 15px of padding on the left and right in addition to horizontal auto margin.
You can simply remove .container > .row > .col-sm-12 in your html and just use a div.

html - adding a div separator between 2 content divs

I am trying to put a (horizontal) separator div between my 2 content divs. Instead of putting it between them, it shows under my banner div (above the 2 content divs).
Here is structure of my html:
<body>
<div id="page">
<div id="header">
<div id="logo"></div>
</div>
<div id="menuContainer">
<div id="menu">
<ul id="btns">
<li>DOMOV</li>
<li>SVETEĽNÉ ZDROJE</li>
<li>CHLADIČE</li>
<li>NAPÁJANIE</li>
<li>KONEKTORY</li>
<li>OPTIKA/REFLEKTORY</li>
<li>KONTAKTY</li>
</ul>
</div>
</div>
<div id="banner"></div>
<div id="separator"></div>
<div id="contentContainer">
<div id="contentBlock">
<div id="contentLeft">
<p id ="nadpis">LED SVETELNE ZDROJE</p>
<p id ="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pulvinar vitae mauris eget vehicula. Integer a mi ut lorem facilisis semper. Etiam faucibus lorem at tellus aliquam, sed aliquet risus venenatis. Etiam vulputate, magna rutrum eleifend rhoncus, justo nulla tristique magna, et tincidunt enim lacus in magna. Curabitur odio risus, eleifend vitae facilisis id, dignissim sed nunc. Pellentesque volutpat metus et scelerisque sagittis. Praesent mattis pulvinar est nec viverra. Nunc suscipit molestie fringilla.</p>
<p id ="katalog">KATALÓG NA STAHNUTIE</p>
<div id="pdf" ></div>
<div id="dodavatelia">
<div id="pic1"></div>
<div id="pic2"></div>
</div>
</div>
<div id="contentRight">
<p id ="rozdelenie">ZÁKLADNÉ ROZDELENIE</p>
<ul id="rozdel">
<li>COB</li>
<li>SMD</li>
<li>LED PÁSY</li>
<li>LED MODULY</li>
</ul>
</div>
</div>
<div id="oddelovac1"></div>
<div id="contentBlock">
<div id="contentLeft">
<p id ="nadpis">LED SVETELNE ZDROJE</p>
<p id ="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pulvinar vitae mauris eget vehicula. Integer a mi ut lorem facilisis semper. Etiam faucibus lorem at tellus aliquam, sed aliquet risus venenatis. Etiam vulputate, magna rutrum eleifend rhoncus, justo nulla tristique magna, et tincidunt enim lacus in magna. Curabitur odio risus, eleifend vitae facilisis id, dignissim sed nunc. Pellentesque volutpat metus et scelerisque sagittis. Praesent mattis pulvinar est nec viverra. Nunc suscipit molestie fringilla.</p>
<p id ="katalog">KATALÓG NA STAHNUTIE</p>
<div id="pdf" ></div>
<div id="dodavatelia">
<div id="citizen"></div>
<div id="qlt"></div>
</div>
</div>
<div id="contentRight">
<p id ="rozdelenie">ZÁKLADNÉ ROZDELENIE</p>
<ul id="rozdel">
<li>COB</li>
<li>SMD</li>
<li>LED PÁSY</li>
<li>LED MODULY</li>
</ul>
</div>
</div>
<div id="separator"></div>
<div id="contentBlock>
... The same structure
</div>
</div>
</div>
</body>
And here is my CSS:
body {
margin:0;
}
#page {
width:100%;
}
#header{
width:1000px;
height:100px;
margin:auto;
}
#logo {
width:140px;
height:47px;
background:url('../img/logo.png')no-repeat;
margin-top:50px;
}
#menuContainer {
height:37px;
width:100%;
background:#c4c8ca;
}
#menu{
width:1000px;
margin:auto;
}
#menu ul {
padding-top:8px;
text-align:right;
}
#banner {
width:100%;
height:353px;
background:url('../img/banner.png')no-repeat;
margin-top:2px;
}
#separator {
width:100%;
height:31px;
background:url('../img/oddelovac.png')no-repeat;
margin-top:6px;
}
#contentContainer {
width:100%;
display:block;
}
#contentBlock {
width:1000px;
margin:auto;
}
#contentLeft {
width:650px;
float:left;
}
#contentRight{
width:350px;
float:left;
}
add clear: both to #separator or overflow: hidden to #contentBlock.
edit:
You use same id attribute value for many elements - there can be only one, unique.
If you want to use same style to many elements then use class.
just add float:left
#contentBlock {
width:1000px;
margin:auto;
float:left;
}
#separator {
width:100%;
height:31px;
background-color:rgb(255,0,255);
margin-top:6px;
float:left;
}

Invalid HTML Unclosed Element

I am getting the following validation errors:
Line 63, Column 7: End tag for body seen but there were unclosed elements.
</body>
Line 19, Column 25: Unclosed element section.<section id="content"
I am using a HTML5 validator and I suspect this error is why my sidebar is not aligning.
CSS:
html{
height:100%;
}
body{
width:960px;
height:100%;
margin:0 auto;
}
p,h1,h2{
margin:25px;
}
header{
width:100%;
border-bottom:1px solid green;
}
header #logo{
height:90px;
width:150px;
border:1px solid red;
}
header nav{
width:100%;
height:45px;
border:1px solid red;
}
header nav ul{
float:left;
}
header nav ul li{
display:inline;
}
header nav li a{
float:left;
text-decoration: none;
margin-left:15px;
}
#content{
float:left;
width:705px;
height:100%;
border:1px solid red;
}
#showcase{
position: relative;
width:705px;
padding:20px 0px 20px 20px;
}
#showcase ul{
float:left;
display:block;
margin-left:-20px;
margin-bottom:20px;
width:200px;
border:1px solid green;
list-style:none;
}
#showcase ul li h3{
margin: 0 0 0 -15px;
letter-spacing: -0.25px;
margin: 4px 0px 3px 0px;
text-indent: 3px;
}
#showcase ul li h3 a {
color: #010101;
text-decoration: none;
}
#showcase ul li h3 a:hover {
color: #4fbcd8;
}
#showcase ul p {
height:70px;
margin:0 0 0 -15px;
line-height: 1.6em;
padding-left: 3px;
}
#showcase ul img{
width:175px;
height:137px;
background-color:pink;
}
#sidebar{
float:right;
height:100%;
width:225px;
border:1px solid red;
}
#box_one, #box_two, #box_three{
height:100px;
border-bottom:1px solid #ccc;
}
footer{
clear:both;
height:24px;
border:1px solid red;
}
HTML:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Template 2011</title>
<link rel="stylesheet" href="_assets/css/style.css">
</head>
<body>
<header>
<div id="logo">Template Here</div>
<nav>
<ul>
<li>Page One</li>
<li>Page Two</li>
<li>Page Three</li>
<li>Page Four</li>
</ul>
</nav>
</header>
<section id="content">
<h1>Main Content Section</h1>
<p>Content</p>
<section id="showcase">
<h1>My Work</h1>
<ul><!-- Showcase One -->
<li>
<img src="#" alt="#" />
<br/>
<h3>Photography</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sem massa, auctor ac tempor at, congue quis erat. Fusce at adipiscing magna. Duis iaculis quam vel ante aliquam eget faucibus nisi pretium. Aenean varius tempus vulputate. Cras ipsum nisi, vehicula id aliquam a, blandit iaculis felis. Sed viverra diam purus. Nam tempor, risus feugiat auctor tristique, arcu massa gravida diam, scelerisque luctus dolor magna eget sapien.</p>
</li>
</ul>
<ul><!-- Showcase Two -->
<li>
<img src="#" alt="#" />
<br/>
<h3>Photography</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sem massa, auctor ac tempor at, congue quis erat. Fusce at adipiscing magna. Duis iaculis quam vel ante aliquam eget faucibus nisi pretium. Aenean varius tempus vulputate. Cras ipsum nisi, vehicula id aliquam a, blandit iaculis felis. Sed viverra diam purus. Nam tempor, risus feugiat auctor tristique, arcu massa gravida diam, scelerisque luctus dolor magna eget sapien.</p>
</li>
</ul>
<ul><!-- Showcase Three -->
<li>
<img src="#" alt="#" />
<br/>
<h3>Photography</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sem massa, auctor ac tempor at, congue quis erat. Fusce at adipiscing magna. Duis iaculis quam vel ante aliquam eget faucibus nisi pretium. Aenean varius tempus vulputate. Cras ipsum nisi, vehicula id aliquam a, blandit iaculis felis. Sed viverra diam purus. Nam tempor, risus feugiat auctor tristique, arcu massa gravida diam, scelerisque luctus dolor magna eget sapien.</p>
</li>
</ul>
</section>
<section id="sidebar">
<div id="box_one">
<p>Box One</p>
</div>
<div id="box_two">
<p>Box Two</p>
</div>
<div id="box_three">
<p>Box Three</p>
</div>
</section>
<footer>
<p>This is the footer</p>
</footer>
</body>
add a </section> closing-tag on line 48 just above the other </section> . it is missing there
The following portion of code seems to be missing an end section tag:
<p>Content</p>
<section id="showcase">
<h1>My Work</h1>
<ul><!-- Showcase One -->
<li>
<img src="#" alt="#" />
<br/>
<h3>Photography</h3>
<p>Lorem ipsum...</p>
</li>
</ul>
<ul><!-- Showcase Two -->
<li>
<img src="#" alt="#" />
<br/>
<h3>Photography</h3>
<p>Lorem ipsum....</p>
</li>
</ul>
<ul><!-- Showcase Three -->
<li>
<img src="#" alt="#" />
<br/>
<h3>Photography</h3>
<p>Lorem ipsum...</p>
</li>
</ul>

Resources