How to stop text from jumping down it's own line - css

This is a follow on from my other post but with a different problem.
I have three CSS labels with text next to each one.
How can I stop the large block of text from jumping down to the next line?
I need the text to start next to the label (same as the colored examples underneath with short amount of text) and then wrap down to the next line once it runs out of space.
.list {
margin: 0;
padding: 0;
list-style-type: none;
}
.list li {
margin-bottom: 10px;
}
.list li > div:first-child{
position: relative;
border-left: 1px solid #fff;
margin-right: 10px;
}
.list li > div{
display: inline-block;
}
.triangle, .triangle2 {
display: block;
position: absolute;
top: 0;
right: -10px;
height: 0;
width: 0;
border-top: 15px solid transparent;
border-left: 10px solid #eee;
border-bottom: 15px solid transparent;
z-index: 1;
}
.triangle2 {
border-left-color: white;
left: 0;
}
.label {
letter-spacing: 1px;
line-height: 30px;
padding: 0 20px 0 30px;
text-decoration: none;
cursor: default;
}
.neutral {
background: #F5F4F9;
}
.neutral .triangle{
border-left: 10px solid #F5F4F9;
}
.neutral .label {
color: #999;
}
.positive {
background: #DFF0D8;
}
.positive .triangle{
border-left: 10px solid #DFF0D8;
}
.positive .label {
color: #468847;
}
.negative {
background: #F2DEDE;
}
.negative .triangle {
border-left: 10px solid #F2DEDE;
}
.negative .label {
color: #b94a48;
}
<ul class="list">
<li>
<div class='neutral'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div class="label-value">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sagittis ipsum tellus, dignissim rhoncus nulla vestibulum ut. Curabitur blandit vitae orci a dignissim. Proin viverra risus velit, sed eleifend odio tincidunt in. Vivamus eu malesuada tortor. Maecenas eleifend faucibus arcu. Phasellus mollis.
</div>
</li>
<li>
<div class='positive'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
<li>
<div class='negative'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
</ul>

Remove the div around the text and it'll wrap around the label automagically.
As a bonus, add a bottom margin to .list li > div to push the new line down a bit more if it looks too close to the label.
.list {
margin: 0;
padding: 0;
list-style-type: none;
}
.list li {
margin-bottom: 10px;
}
.list li > div:first-child{
position: relative;
border-left: 1px solid #fff;
margin-right: 10px;
}
.list li > div{
display: inline-block;
}
.triangle, .triangle2 {
display: block;
position: absolute;
top: 0;
right: -10px;
height: 0;
width: 0;
border-top: 15px solid transparent;
border-left: 10px solid #eee;
border-bottom: 15px solid transparent;
z-index: 1;
}
.triangle2 {
border-left-color: white;
left: 0;
}
.label {
letter-spacing: 1px;
line-height: 30px;
padding: 0 20px 0 30px;
text-decoration: none;
cursor: default;
}
.neutral {
background: #F5F4F9;
}
.neutral .triangle{
border-left: 10px solid #F5F4F9;
}
.neutral .label {
color: #999;
}
.positive {
background: #DFF0D8;
}
.positive .triangle{
border-left: 10px solid #DFF0D8;
}
.positive .label {
color: #468847;
}
.negative {
background: #F2DEDE;
}
.negative .triangle {
border-left: 10px solid #F2DEDE;
}
.negative .label {
color: #b94a48;
}
<ul class="list">
<li>
<div class='neutral'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sagittis ipsum tellus, dignissim rhoncus nulla vestibulum ut. Curabitur blandit vitae orci a dignissim. Proin viverra risus velit, sed eleifend odio tincidunt in. Vivamus eu malesuada tortor. Maecenas eleifend faucibus arcu. Phasellus mollis.
</li>
<li>
<div class='positive'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
<li>
<div class='negative'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
</ul>

A solution with flexbox:
add display: flex; align-items: flex-start; on your li element.
add flex: none on the first child of your li element.
If you want to center the text you can add a litte padding-top on your second child
See https://developer.mozilla.org/en-US/docs/Web/CSS/flex for further explanations how flex works.
Note : flex works on IE10 and higher, but you need to add the -ms- prefix for IE10.
.list {
margin: 0;
padding: 0;
list-style-type: none;
}
.list li {
margin-bottom: 10px;
display: flex;
align-items: flex-start;
}
.list li > div:first-child{
position: relative;
border-left: 1px solid #fff;
margin-right: 10px;
flex: none;
padding-top : 0;
}
.list li > div{
display: inline-block;
padding-top : 6px;
}
.triangle, .triangle2 {
display: block;
position: absolute;
top: 0;
right: -10px;
height: 0;
width: 0;
border-top: 15px solid transparent;
border-left: 10px solid #eee;
border-bottom: 15px solid transparent;
z-index: 1;
}
.triangle2 {
border-left-color: white;
left: 0;
}
.label {
letter-spacing: 1px;
line-height: 30px;
padding: 0 20px 0 30px;
text-decoration: none;
cursor: default;
}
.neutral {
background: #F5F4F9;
}
.neutral .triangle{
border-left: 10px solid #F5F4F9;
}
.neutral .label {
color: #999;
}
.positive {
background: #DFF0D8;
}
.positive .triangle{
border-left: 10px solid #DFF0D8;
}
.positive .label {
color: #468847;
}
.negative {
background: #F2DEDE;
}
.negative .triangle {
border-left: 10px solid #F2DEDE;
}
.negative .label {
color: #b94a48;
}
<ul class="list">
<li>
<div class='neutral'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div class="label-value">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sagittis ipsum tellus, dignissim rhoncus nulla vestibulum ut. Curabitur blandit vitae orci a dignissim. Proin viverra risus velit, sed eleifend odio tincidunt in. Vivamus eu malesuada tortor. Maecenas eleifend faucibus arcu. Phasellus mollis.
</div>
</li>
<li>
<div class='positive'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
<li>
<div class='negative'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
</ul>

You can use "float: left" to wrap your div (note that I moved your label), but maybe there are some more modern approaches
.list {
margin: 0;
padding: 0;
list-style-type: none;
}
.list li {
margin-bottom: 10px;
}
.list li > div:first-child{
position: relative;
border-left: 1px solid #fff;
margin-right: 10px;
}
.list li > div{
display: inline-block;
}
.triangle, .triangle2 {
display: block;
position: absolute;
top: 0;
right: -10px;
height: 0;
width: 0;
border-top: 15px solid transparent;
border-left: 10px solid #eee;
border-bottom: 15px solid transparent;
z-index: 1;
}
.triangle2 {
border-left-color: white;
left: 0;
}
.label {
letter-spacing: 1px;
line-height: 30px;
padding: 0 20px 0 30px;
text-decoration: none;
cursor: default;
}
.neutral {
background: #F5F4F9;
}
.neutral .triangle{
border-left: 10px solid #F5F4F9;
}
.neutral .label {
color: #999;
}
.positive {
background: #DFF0D8;
}
.positive .triangle{
border-left: 10px solid #DFF0D8;
}
.positive .label {
color: #468847;
}
.negative {
background: #F2DEDE;
}
.negative .triangle {
border-left: 10px solid #F2DEDE;
}
.negative .label {
color: #b94a48;
}
<ul class="list">
<li>
<div class="label-value">
<div class='neutral' style="float: left">
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sagittis ipsum tellus, dignissim rhoncus nulla vestibulum ut. Curabitur blandit vitae orci a dignissim. Proin viverra risus velit, sed eleifend odio tincidunt in. Vivamus eu malesuada tortor. Maecenas eleifend faucibus arcu. Phasellus mollis.
</div>
</li>
<li>
<div class='positive'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
<li>
<div class='negative'>
<span class="triangle2"></span>
<span class="label">some text</span>
<span class="triangle"></span>
</div>
<div>
Some other text
</div>
</li>
</ul>

Related

How to clip floated content

The following code snippet displays some headlines, with some icons floated on the left. The parent div has a defined height, with scroll:auto set.
Currently, scrolling to the bottom looks like this:
However, I'd like to clip off the icons when the text entries end, so when scrolling to the bottom, it looks like this:
The reason for the use of float is so that when there are not many icons, the text flows like this:
.parent {
position: absolute;
height: 100px;
width: 400px;
overflow: scroll;
}
.content {
background-color: cyan;
padding: 6px;
}
.icon {
float: left;
clear: both;
background-color: lightpink;
width: 38px;
height: 38px;
margin-right: 8px;
margin-bottom: 6px;
}
.entry {
font-size: 18px;
}
<div class="parent">
<div class="content">
<img class="icon">
<img class="icon">
<img class="icon">
<img class="icon">
<div class="entry">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="entry">Quisque eleifend viverra risus, nec maximus nisi vestibulum eu</div>
<div class="entry">Mauris in libero lacus</div>
</div>
</div>
Just smack a overflow: clip on your .content along with the sexy overflow-clip-margin: content-box.
Note on overflow-clip-margin: Safari doesn't support it (yet). Quick edit: Firefox has some issues with overflow-clip-margin's visual-box property too. My bad!
Without it, the images are still clipped but without caring about your .content padding. Shouldn't be an issue if your text isn't actually behind a cyan background-color; it's hard to tell on a white background.
.parent {
position: absolute;
height: 100px;
width: 400px;
overflow: scroll;
}
.content {
background-color: cyan;
padding: 6px;
overflow: clip;
overflow-clip-margin: content-box;
}
.icon {
float: left;
clear: both;
background-color: lightpink;
width: 38px;
height: 38px;
margin-right: 8px;
margin-bottom: 6px;
}
.entry {
font-size: 18px;
}
<div class="parent">
<div class="content">
<img class="icon">
<img class="icon">
<img class="icon">
<img class="icon">
<div class="entry">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="entry">Quisque eleifend viverra risus, nec maximus nisi vestibulum eu</div>
<div class="entry">Mauris in libero lacus</div>
</div>
</div>
.parent {
position: absolute;
height: 100px;
width: 400px;
overflow: scroll;
}
.content {
background-color: cyan;
padding: 6px 6px 0 6px;
overflow: hidden;
position: relative;
border-bottom: 8px solid cyan; /* same color */
}
.icons,
.entries {
display: flex;
flex-direction: column;
}
.icons {
position: absolute;
top: 8px;
left: 8px;
}
.entries {
margin-left: 56px; /* icon width '38' + icon left '8' and right '8' distance */
}
.icon {
background-color: lightpink;
width: 38px;
height: 38px;
margin-bottom: 6px;
}
.entry {
font-size: 18px;
}
<div class="parent">
<div class="content">
<div class="icons">
<img class="icon">
<img class="icon">
<img class="icon">
<img class="icon">
</div>
<div class="entries">
<div class="entry">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="entry">Quisque eleifend viverra risus, nec maximus nisi vestibulum eu</div>
<div class="entry">Mauris in libero lacus</div>
</div>
</div>
</div>

Dropdown hides before I can hover on the sub menu

Why does my dropdown hide really fast? I must hover quickly to my sub dropdown to make the dropdown still display.
I think my problem was on the select but I don't know how to implement it.
Here is my code:
body {
font-family: Verdana, Geneva, sans-serif;
padding: 0;
margin: 0;
}
.ic {
font-weight: bold;
margin-right: 5px;
font-size: .9rem;
}
.wrap {
background-color: black;
}
#topbar {
overflow: hidden;
padding: 0;
width: 1200px;
height: 50px;
margin: auto;
text-transform: uppercase;
font-size: .8rem;
}
.nospace {
color: white;
}
li {
margin: 15px;
}
li.left {
float: left;
list-style: none;
}
li.right {
float: right;
list-style: none;
}
li a {
text-decoration: none;
color: aqua;
}
#banner {
background: url(bg1.jpg) no-repeat center;
height: 600px;
background-size: 1650px;
opacity: 0.7;
font-family: 'Forum', cursive;
font-size: 20px;
}
ul li {
list-style-type: none;
padding: 0;
margin: 0;
position: relative;
}
nav li {
position: relative;
}
.menubar {
width: 1200px;
margin: auto;
display: block;
}
.menubar a {
padding: 10px;
color: black;
}
.menubar a:hover {
color: blue;
}
.drop-nav {
position: relative;
}
.drop-nav:after {
content: "\25BC";
font-size: .5em;
display: block;
position: absolute;
top: 40%;
right: 1%;
}
#content {
padding: 0;
display: none;
height: 0px;
z-index: 1;
}
#content a {
color: white;
border-bottom: 1px solid black;
background-color: rgba(0,0,0,0.5);
text-decoration: none;
display: block;
text-align: center;
}
#content a:hover {
background-color: aqua;
}
li:hover ul#content {
display: block;
position: absolute;
top: 25px;
left: 0px;
width: 120px;
visibility: visible;
}
.wrap01 {
height: 60px;
border-bottom: 1px solid gray;
}
.isi{
width: 1200px;
margin: auto;
text-align: center;
padding: 20px;
}
.boxutama{
width: 1200px;
margin: auto;
padding: 20px;
}
.boxkecil{
display: inline-block;
width: 360px;
margin: auto;
text-align: center;
padding: 15px;
}
i{
color: blue;
}
.boxkecil a{
text-decoration: none;
}
.boxkedua{
overflow: hidden;
height: 180px;
background-color: black;
font-family: 'Forum', cursive;
}
.isi2{
color: white;
width: 1200px;
margin: auto;
display: block;
}
.spanleft{
float: left;
width: 50%;
padding: 20px;
padding-left: 100px;
margin: auto;
}
.spanright{
float: right;
padding: 20px;
padding-right: 100px;
margin: auto;
line-height: 138px;
}
.btn1{
margin: auto;
border: 1px solid blue;
text-transform: uppercase;
padding: 10px;
text-decoration: none;
font-family: Verdana, Geneva, sans-serif;
}
.boxketiga{
overflow: hidden;
width: 1200px;
padding: 20px;
margin: auto;
margin-top: 20px;
}
.one_half_first{
float: left;
padding: 20px;
}
.one_half{
padding: 20px;
float: right;
width: 49%;
text-align: left;
}
.gambarcontoh{
width: 480px;
height: 400px;
padding: 20px;
border: 1px solid #D7D7D7;
}
.tanggal{
margin: 0px;
padding: 0px;
font-size: .8rem;
}
.heading{
margin-top: 5px;
}
.boxkeempat{
font-family: 'Forum', cursive;
background-color: black;
height: 220px;
}
.isi3{
width: 1200px;
margin: auto;
display: block;
text-align: center;
}
.atas {
color: white;
padding: 20px;
padding-top: 20px;
}
.atas h3{
font-weight: bold;
font-size: 20px;
}
.bawah{
padding-top: 20px;
}
.btn2{
border: 1px solid white;
text-transform: uppercase;
padding: 10px;
color: white;
text-decoration: none;
font-family: Verdana, Geneva, sans-serif;
}
.boxkelima{
}
.wraplima{
width: 1500px;
margin: auto;
padding: 20px;
margin-top: 10px;
display: block;
text-align: center;
font-family: Georgia,"Times New Roman",Times,serif;
}
.isikotak{
width: 250px;
margin: auto;
margin: 0 15px;
display: inline-block;
font-family: 'Forum', cursive;
font-size: 13px;
}
.kotakfoto{
margin-top: 20px;
border: 1px solid #D7D7D7;
}
img.foto{
padding: 15px;
max-width: 220px;
max-height: 320px;
-webkit-filter: sepia(100%);
filter: sepia(100%);
}
.kotakkcl{
padding: 5px;
position: relative;
display: block;
left: 37%;
width: 157px;
margin: -55px;
background-color: white;
border: 1px solid #d7d7d7;
}
.kotakkcl h3, p{
margin: auto;
}
.boxfooter{
background: url(bg11.jpg);
}
.boxfooter a{
text-decoration: none;
color: white;
}
.ovlay{
background-color: rgba(0,0,0,0.7);
}
.boxf1{
width: 1200px;
margin: auto;
}
.boxatas1{
text-align: center;
color: white;
font-family: 'Forum', cursive;
padding-top: 40px;
margin-bottom: 60px;
}
.grup{
width: 1200px;
margin: auto;
margin-top: 10px;
}
.dalam1{
display: inline-block;
text-align: center;
margin: 10.3px
}
.icon{
position: absolute;
left: 295px;
top: 2759px;
}
.icon i::before{
padding: 20px;
background: linear-gradient(to top right,#000,#666);
border-radius: 50%;
border:1px solid white;
}
.icon i{
color: white;
border-radius: 50%;
padding: 20px;
}
.dalam{
color: white;
padding: 20px;
padding-top: 40px;
border: 1px solid white;
width: 233px;
}
.footermenu{
margin: auto;
margin-top: 20px;
background-color: rgba(0,0,0,.5);
}
.menufooter{
width: 1200px;
margin: auto;
text-align: center;
padding: 20px;
}
.menufooter a{
padding: 0 20px;
text-decoration: none;
border-left: 1px solid white;
text-align: center;
margin: 0, 5px;
}
.footerbawah{
overflow: hidden;
width: 1000px;
margin: auto;
padding: 20px;
color: white;
}
p.left {
float: left;
}
p.right {
float: right;
}
<!DOCTYPE html>
<html>
<head>
<title>New DPW</title>
<link href="new1.css" rel="stylesheet" type="text/css" media="all">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Forum" rel="stylesheet">
</head>
<body>
<div class="Halaman">
<div class="wrap">
<div id="topbar">
<div class="nospace">
<li class="left"><span class="ic">☏</span> +00 (123) 456 7890</li>
<li class="left"><span class="ic">✉</span> info#pajak.go.id</li>
<li class="right">Tentang</li>
<li class="right">Kontak</li>
<li class="right">Login</li>
<li class="right">Register</li>
<li class="right"><i class="fa fa-home"></i></li>
</div>
</div>
</div>
<div id="banner">
<div class="wrap01">
<nav class="menubar">
<li class="left">Sistem Pemberkasan Gudang</li>
<li class="right">Peraturan</li>
<li class="right"></li>
<li class="right"><a class="drop-nav" href="#">Pajak</a>
<ul id="content">
Pajak Bangunan
Pajak Penghasilan
Pajak Kendaraan
Pajak Perdagangan
</ul>
</li>
<li class="right"><a class="drop-nav" href="#">Halaman</a>
<ul id="content">
Artikel
zero 1
</ul>
</li>
<li class="right">Rumah</li>
</nav>
</div>
</div>
<div class="wrapmain">
<main class="utama">
<div class= "isi">
<h3>Risus sed justo tinciduntt</h3>
<p>Cras dapibus ipsum vel eleifend commodo eros tortor imperdiet elit eget molestie nisi lectus.</p>
</div>
<div class="boxutama">
<div class="boxkecil">
<article><i class="fa fa-cubes" style="font-size: 200%;"></i>
<h6>Pellentesque libero</h6>
<p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p>
<footer>Read More »</footer>
</article>
</div>
<div class="boxkecil">
<article><i class="fa fa-css3" style="font-size: 200%;"></i>
<h6>Pellentesque libero</h6>
<p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p>
<footer>Read More »</footer>
</article>
</div>
<div class="boxkecil">
<article><i class="fa fa-dashcube" style="font-size: 200%;"></i>
<h6>Pellentesque libero</h6>
<p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p>
<footer>Read More »</footer>
</article>
</div>
<div class="boxkecil">
<article><i class="fa fa-database" style="font-size: 200%;"></i>
<h6>Pellentesque libero</h6>
<p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p>
<footer>Read More »</footer>
</article>
</div>
<div class="boxkecil">
<article><i class="fa fa-desktop" style="font-size: 200%;"></i>
<h6>Pellentesque libero</h6>
<p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p>
<footer>Read More »</footer>
</article>
</div>
<div class="boxkecil">
<article><i class="fa fa-dropbox" style="font-size: 200%;"></i>
<h6>Pellentesque libero</h6>
<p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p>
<footer>Read More »</footer>
</article>
</div>
</div>
</main>
</div>
<div class="boxkedua">
<div class="isi2">
<div class="spanleft">
<H3>Pajak Negara Indonesia</H3>
Pajak adalah pungutan wajib yang dibayar rakyat untuk negara dan akan digunakan untuk kepentingan pemerintah dan masyarakat umum</div>
<div class="spanright">
<a class="btn1" href="#">More Information »</a>
</div>
</div>
</div>
<div class="boxketiga">
<div class="one_half_first"><img class="gambarcontoh" src="bg1.jpg" alt=""></div>
<div class="one_half">
<p class="tanggal">Tanggal, 22 Juli 2018</p>
<h3 class="heading">Venenatis erat nunc lorem</h3>
<p>Sed pharetra non sollicitudin nec libero curabitur dapibus ex non viverra scelerisque arcu nisl dignissim enim in lacinia dolor libero id urna duis sodales dignissim enim.</p>
<blockquote>Interdum integer vestibulum venenatis justo id vulputate mi curabitur ac odio sed diam ullamcorper pulvinar proin tristique odio non suscipit venenatis magna enim convallis arcu vitae blandit turpis</blockquote>
<p>Sed pharetra non sollicitudin nec libero curabitur dapibus ex non viverra scelerisque arcu nisl dignissim enim in lacinia dolor libero id urna duis sodales dignissim enim. asfasjkfjkahsjhfjhasj asklfkjaskljfkjaisdfiwe sdkjfkjsdkljiieghwe kjdkfjsidigiosg kasdjklfjkajdklgjioae lasjklfjliajew9fqe ioajsdijiljadg9 ladkjlkgj lkajs fl aksklklfjklajsfioaw asjksjafj asfkjasjfh uasfuiqwio. askljlasjlkfjkasf askljfkljalksjfqowjf eklsdlklisod pfawp fawoifpoiawpoif paw fpawf aw ofoaw f poawpo fpoawipfi iawo weokoriweirpoaiskfokasopifpwea okd po foasofkpoaifpow pojfowifpaw pof.</p>
<footer>Read More »</footer>
</div>
</div>
<div class="boxkeempat">
<div class="isi3">
<div class="atas">
<h3>Pajak Negara Indonesia</h3>
<p>Pajak adalah pungutan wajib yang dibayar rakyat untuk negara dan akan digunakan untuk kepentingan pemerintah dan masyarakat umum.</p>
</div>
<div class="bawah">
<a class="btn2" href="#">Sudahkah Anda Membayar Pajak..?</a>
</div>
</div>
</div>
<div class="boxkelima">
<div class="wraplima">
<h3>CREATOR OF THIS WEBSITE</h3>
<p>Berikut adalah seluruh anggota yang membuat web sederhana ini</p>
<div class="isikotak">
<div class="kotakfoto">
<img class="foto" src="maya.jpg" alt="">
</div>
<div class="kotakkcl">
<p style="color: blue; font-size: 1.2em;">Staff</p>
<h3>M Bima Sakti Admaja</h3>
<p>150411100080</p>
</div>
</div>
<div class="isikotak">
<div class="kotakfoto">
<img class="foto" src="maya.jpg" alt="">
</div>
<div class="kotakkcl">
<p style="color: blue; font-size: 1.2em;">Staff</p>
<h3>M Bima Sakti Admaja</h3>
<p>150411100080</p>
</div>
</div>
<div class="isikotak">
<div class="kotakfoto">
<img class="foto" src="maya.jpg" alt="">
</div>
<div class="kotakkcl">
<p style="color: blue; font-size: 1.2em;">Staff</p>
<h3>M Bima Sakti Admaja</h3>
<p>150411100080</p>
</div>
</div>
<div class="isikotak">
<div class="kotakfoto">
<img class="foto" src="maya.jpg" alt="">
</div>
<div class="kotakkcl">
<p style="color: blue; font-size: 1.2em;">Staff</p>
<h3>M Bima Sakti Admaja</h3>
<p>150411100080</p>
</div>
</div>
</div>
</div>
<div class="boxfooter">
<div class="ovlay">
<div class="boxf1">
<div class="boxatas1">
<h2 class="heading" style="margin-bottom: 10px; text-transform: capitalize;" >dui eu laoreet aenean non</h2>
<p>dapibus lacus phasellus quis ligula ut libero venenatis scelerisque</p>
</div>
<div class="grup">
<div class="dalam1">
<div class="icon"><i class="fa fa-phone fa-lg"></i></div>
<div class="dalam">
<div>+62 (009) 340 9549</div>
<div>1 (500) 200</div>
</div>
</div>
<div class="dalam1">
<div class="icon" style="left: 588px;"><i class="fa fa-envelope-o fa-lg"></i></div>
<div class="dalam">
<div>www.pajak.go.id</div>
<div>#DitjenPajakRI</div>
</div>
</div>
<div class="dalam1">
<div class="icon" style="left: 893px;"><i class="fa fa-clock-o fa-lg"></i></div>
<div class="dalam">
<div>Sen-Jum: 8.00 - 2.00</div>
<div>Sabtu: 9.00 - 1.00</div>
</div>
</div>
<div class="dalam1">
<div class="icon" style="left: 1194px;"><i class="fa fa-support fa-lg"></i></div>
<div class="dalam">
<div>Online Support</div>
<div>Live Chat</div>
</div>
</div>
</div>
</div>
<div class="footermenu">
<div class="menufooter">
<i class="fa fa-home fa-lg" style="color: white"></i>
TENTANG
KONTAK
PERATURAN
</div>
</div>
<div class="footerbawah">
<p class="left">Copyright © 2018 - All Rights Reserved - Domain Name</p>
<p class="right">Powered by :Trunojoyo.ac.id</p>
</div>
</div>
</div>
</div>
</body>
</html>
The reason why the sub menu closes too quickly is that you have a small gap between the main menu button and the sub menu so the mouse detects its rolled out of the sub menu button and closes.
just increase the size of the main menu buttons and that should do it :)

How can I add a space between them and keep text same line

how can I add a space between those 2 images and dont allow the text to break on the center of the page? It's for a college project and I've never programmed before.
i actually dont know whats going on on this template i have to edit.. i just need to add a photo of a person in the image circle (which i know how to) and a text of their review, but the images keep going off position and text breaks in the middle..
/*
Horizons by TEMPLATED
templated.co #templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
*/
#import url("font-awesome.min.css");
#import url("http://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900");
/* Basic */
}
body {
background: #222833;
}
body,
input,
select,
textarea {
color: #555555;
font-family: 'Raleway', sans-serif;
font-size: 13pt;
font-weight: 300;
line-height: 1.75em;
}
a {
color: #3ac984;
text-decoration: underline;
}
a:hover {
text-decoration: none;
}
strong,
b {
font-weight: 700;
}
em,
i {
font-style: italic;
}
p,
ul,
ol,
dl,
table,
blockquote {
margin: 0 0 2em 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: inherit;
font-weight: 700;
line-height: 1.75em;
margin-bottom: 1em;
}
h1 a,
h2 a,
h3 a,
h4 a,
h5 a,
h6 a {
color: inherit;
text-decoration: none;
}
h2 {
font-size: 1.5em;
}
h3 {
font-size: 1.25em;
}
sub {
font-size: 0.8em;
position: relative;
top: 0.5em;
}
sup {
font-size: 0.8em;
position: relative;
top: -0.5em;
}
hr {
border-top: solid 1px #888888;
border: 0;
margin-bottom: 1.5em;
}
blockquote {
border-left: solid 0.5em #888888;
font-style: italic;
padding: 1em 0 1em 2em;
}
section.special,
article.special {
text-align: center;
}
header.major {
padding-bottom: 4em;
}
header h2 {
margin: 0;
padding: 0;
font-size: 3em;
font-weight: 600;
}
header .byline {
font-size: 1.6em;
}
footer> :last-child {
margin-bottom: 0;
}
footer.major {
padding-top: 3em;
}
/* Form */
input[type="text"],
input[type="password"],
input[type="email"],
textarea {
-moz-appearance: none;
-webkit-appearance: none;
-o-appearance: none;
-ms-appearance: none;
appearance: none;
background: none;
border: solid 1px #888888;
color: inherit;
display: block;
outline: 0;
padding: 0.75em;
text-decoration: none;
width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
border-color: #3ac984;
}
input[type="text"],
input[type="password"],
input[type="email"] {
line-height: 1em;
}
::-webkit-input-placeholder {
color: inherit;
opacity: 0.5;
position: relative;
top: 3px;
}
:-moz-placeholder {
color: inherit;
opacity: 0.5;
}
::-moz-placeholder {
color: inherit;
opacity: 0.5;
}
:-ms-input-placeholder {
color: inherit;
opacity: 0.5;
}
.formerize-placeholder {
color: rgba(85, 85, 85, 0.5) !important;
}
/* Image */
.image {
border: 0;
position: relative;
}
.image.fit {
display: block;
}
.image.fit img {
display: block;
width: 100%;
}
.image.feature {
display: block;
margin: 0 0 2em 0;
}
.image.feature img {
display: block;
width: 100%;
}
.image.feature2 {
display: block;
margin: 0 0 5em 0;
}
.image.feature2 img {
display: block;
width: 100%;
border-radius: 50%;
width: 200px;
height: 200px;
float: left margin 40px;
}
/* Icon */
.icon {
position: relative;
}
.icon:before {
content: "";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-transform: none !important;
}
.icon>.label {
display: none;
}
/* Lists */
ol.default {
list-style: decimal;
padding-left: 1.25em;
}
ol.default li {
padding-left: 0.25em;
}
ul {
margin: 0;
padding: 0;
}
ul.default {
list-style: none;
}
ul.default li {
display: block;
padding: 0.60em 0;
border-top: 1px solid;
border-color: rgba(192, 192, 192, 0.15);
}
ul.default> :first-child {
padding-top: 0;
border-top: none;
}
ul.icons {
cursor: default;
}
ul.icons li {
display: inline-block;
line-height: 1em;
padding-left: 0.5em;
}
ul.icons li:first-child {
padding-left: 0;
}
ul.actions {
cursor: default;
}
ul.actions:last-child {
margin-bottom: 0;
}
ul.actions li {
display: inline-block;
padding: 0 0 0 1.5em;
}
ul.actions li:first-child {
padding: 0;
}
ul.actions.vertical li {
display: block;
padding: 1.5em 0 0 0;
}
ul.actions.vertical li:first-child {
padding: 0;
}
ul.contact li {
padding: 1.05em 0;
border-top: 1px solid;
border-color: rgba(192, 192, 192, 0.15);
}
ul.contact li>span {
display: inline-block;
}
ul.contact li .address,
ul.contact li .mail,
ul.contact li .phone {
float: left;
width: 100px;
font-weight: 600;
}
ul.contact> :first-child {
padding-top: 0;
border-top: none;
}
ul.style li {
clear: both;
display: block;
padding-top: 3em;
}
ul.style> :first-child {
padding-top: 0;
}
ul.style h3 {
display: block;
margin: 0;
padding-bottom: 0.50em;
font-size: 1.1em;
font-weight: 700;
color: #404040;
}
ul.style .fa {
float: left;
display: inline-block;
width: 80px;
height: 80px;
margin-right: 1em;
background: #3ac984;
line-height: 80px;
text-align: center;
border-radius: 10px;
font-size: 2em;
color: white;
}
ul.list {
list-style: none;
}
ul.list li {
display: block;
padding: 0.60em 0;
border-top: 1px solid;
border-color: red;
}
ul.list> :first-child {
padding-top: 0;
border-top: none;
}
/* Tables */
table {
width: 100%;
}
table.default {
width: 100%;
}
table.default tbody tr {
border-bottom: solid 1px #888888;
}
table.default td {
padding: 0.5em 1em 0.5em 1em;
}
table.default th {
font-weight: 700;
padding: 0.5em 1em 0.5em 1em;
text-align: left;
}
table.default thead {
background: #555555;
color: #fff;
}
/* Button */
input[type="submit"],
input[type="reset"],
input[type="button"],
.button {
-moz-appearance: none;
-webkit-appearance: none;
-o-appearance: none;
-ms-appearance: none;
appearance: none;
-moz-transition: background-color 0.2s ease-in-out;
-webkit-transition: background-color 0.2s ease-in-out;
-o-transition: background-color 0.2s ease-in-out;
-ms-transition: background-color 0.2s ease-in-out;
transition: background-color 0.2s ease-in-out;
background: #3ac984;
border-radius: 40px;
border: 0;
color: white;
cursor: pointer;
display: inline-block;
padding: 0.80em 2em;
text-align: center;
text-decoration: none;
font-size: 1.4em;
font-weight: 600;
min-width: 10em;
}
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover,
.button:hover {
background-color: #32b777;
}
input[type="submit"].fit,
input[type="reset"].fit,
input[type="button"].fit,
.button.fit {
width: 100%;
}
input[type="submit"].small,
input[type="reset"].small,
input[type="button"].small,
.button.small {
font-size: 0.8em;
}
/* Wrapper */
.wrapper.style1 {
background: #fff;
}
.wrapper.style2 {
background: #ececec;
padding: 6em 0;
text-align: center;
}
.wrapper.style4 {
background: #ececec;
padding: 1em 0;
text-align: center;
}
.wrapper.style3 {
padding: 2em 0 3.5em 0;
background: #ececec;
}
.wrapper.style3 span {
display: inline-block;
padding-top: 0.80em;
font-size: 2em;
font-weight: 600;
}
.wrapper.style3 .button {
float: right;
}
/* Header */
#header {
background: #333333 url("../images/pic01.jpg") no-repeat;
background-size: cover;
color: #fff;
padding: 6em 0;
text-align: center;
background-position: 0% 65%;
position: relative;
}
#header:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(16, 32, 48, 0.25);
}
#header>* {
position: relative;
z-index: 1;
}
.homepage #header {
padding: 8em 0;
background-position: center;
}
#logo {
font-size: 2em;
}
#nav>ul {
margin: 0;
}
#nav>ul>li {
border-radius: 10px 10px 0 0;
display: inline-block;
margin-left: 0.5em;
padding: 0.5em 1.5em;
}
#nav>ul>li a {
color: #FFF;
text-decoration: none;
font-size: 1.2em;
}
#nav>ul>li:first-child {
margin-left: 0;
}
#nav>ul>li:hover a {
color: #fff;
}
#nav>ul>li.active {
background: #3ac984;
}
#nav>ul>li.active a {
color: white;
}
#nav>ul>li>ul {
display: none;
}
/* Dropotron */
.dropotron {
margin-top: -2px;
background: #3ac984;
border-radius: 10px;
color: white;
min-width: 12em;
padding: 1em 0;
}
.dropotron>li {
line-height: 2em;
padding: 0 1em;
}
.dropotron>li>a {
color: #FFF;
text-decoration: none;
}
.dropotron>li.active>a,
.dropotron>li:hover>a {
color: #FFF;
}
.dropotron.level-0 {
border-radius: 0 10px 10px 10px;
font-size: 1em;
}
/* Banner */
#banner {
text-align: center;
padding: 4em 0 0 0;
}
#banner .major h2 {
font-size: 3.5em;
}
#banner .major .byline {
display: block;
margin: 0em 2em;
line-height: 1.6em;
font-size: 1.5em;
}
#banner a {
color: inherit;
}
/* Main */
.no-sidebar #main .major,
.left-sidebar #main .major,
.right-sidebar #main .major {
text-align: left;
}
.homepage #main .major {
text-align: center;
}
#main {
padding: 6em 0;
}
#main .sidebar .major {
padding-bottom: 2em;
}
#main .sidebar .major h2 {
font-size: 1.8em;
}
#main .sidebar .default li {
border-color: #cdcdcd;
}
#main .sidebar .default a {
color: #464646;
}
#main .sidebar> :first-child {
margin-bottom: 3em;
}
/* Footer */
#footer {
padding: 4em 0;
color: #fff;
}
#footer .major h2 {
font-size: 2em;
color: #FFF;
}
#footer .major .byline {
font-size: 1.1em;
}
#footer .copyright {
margin-top: 3em;
padding-top: 3em;
border-top: 1px solid;
border-color: rgba(192, 192, 192, 0.15);
text-align: center;
color: inherit;
}
#footer a {
color: inherit;
}
#middle {
height: 600px;
width: 300px;
background: green;
}
<!DOCTYPE HTML>
<!--
Horizons by TEMPLATED
templated.co #templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
-->
<html>
<head>
<title>Horizons by TEMPLATED</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.dropotron.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-layers.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
</noscript>
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
</head>
<body class="homepage">
<!-- Header -->
<div id="header">
<div class="container">
<!-- Logo -->
<h1>Vista 702</h1>
<!-- Nav -->
<nav id="nav">
<ul>
<li>Fotos</li>
<li>Depoimentos</li>
<li>Planos</li>
</nav>
<!-- Banner -->
<div id="banner">
<div class="container">
<section>
<header class="major">
<h2>Vista 702</h2>
<span class="byline">… a melhor vista de Juiz de Fora para se passar o feriado, réveillon e comemorações em geral.</span>
</header>
Sign Up
</section>
</div>
</div>
</div>
</div>
<!-- Featured -->
<div class="wrapper style2">
<section class="container">
<header class="major">
<a id="fotos"></a>
<h2>Fotos</h2>
<span class="byline">Sua visita começa aqui.</span>
</header>
<div class="row no-collapse-1">
<section class="4u">
<a class="image feature"><img src="images/pic02.jpg" alt=""></a>
<p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p>
</section>
<section class="4u">
<a class="image feature"><img src="images/pic03.jpg" alt=""></a>
<p>Donec ornare neque ac sem. Mauris aliquet. Aliquam sem leo, vulputate sed, convallis. Donec magna.</p>
</section>
<section class="4u">
<a class="image feature"><img src="images/pic04.jpg" alt=""></a>
<p>Curabitur sem urna, consequat vel, suscipit convallis sem leo, mattis placerat, nulla. Sed ac leo.</p>
</section>
</div>
</section>
</div>
<div class="wrapper style2">
<section class="container">
<header class="major">
<a id="depoimentos"></a>
<h2>Depoimentos</h2>
<span class="byline">Os viajantes recomendam.</span>
</header>
<div class="row no-collapse-1">
<section class="">
<a class="image feature2"><img src="https://abrilexame.files.wordpress.com/2016/09/size_960_16_9_google-robert-bunsen.jpg" align="left"=""></a>
<p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p>
</section>
<section class="">
<a class="image feature2"><img src="https://eduardhosp-alemao.com.br/wp-content/uploads/2018/05/Hashtag-Google-Alem%C3%A3o-Sem-Complica%C3%A7%C3%A3o.jpg" align="left"></a>
<p>Curabitur sem urna, consequat vel, suscipit convallis sem leo, mattis placerat, nulla. Sed ac leo.</p>
</section>
</div>
</section>
</div>
<!-- Main -->
<div id="main" class="wrapper style1">
<section class="container">
<header class="major">
<a id="planos"></a>
<h2>Uma janelas, diversas</h2>
<span class="byline">Um plano para todos os bolsos.</span>
</header>
<div class="row">
<!-- Content -->
<div class="6u">
<section>
<ul class="style">
<li>
<span class="fa fa-wrench"></span>
<h3>Integer ultrices</h3>
<span>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim.</span>
</li>
<li>
<span class="fa fa-cloud"></span>
<h3>Aliquam luctus</h3>
<span>Pellentesque viverra vulputate enim. Aliquam erat volutpat. Maecenas condimentum enim tincidunt risus accumsan.</span>
</li>
</ul>
</section>
</div>
<div class="6u">
<section>
<ul class="style">
<li>
<span class="fa fa-cogs"></span>
<h3>Integer ultrices</h3>
<span>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim.</span>
</li>
<li>
<span class="fa fa-leaf"></span>
<h3>Aliquam luctus</h3>
<span>Pellentesque viverra vulputate enim. Aliquam erat volutpat. Maecenas condimentum enim tincidunt risus accumsan.</span>
</li>
</ul>
</section>
</div>
</div>
</section>
</div>
<!-- Footer -->
<div id="footer">
<div class="container">
<!-- Lists -->
<div class="row">
<div class="8u">
<section>
<header class="major">
<h2>Donec dictum metus</h2>
<span class="byline">Quisque semper augue mattis wisi maecenas ligula</span>
</header>
<div class="row">
<section class="6u">
<ul class="default">
<li>Pellentesque elit non gravida blandit.</li>
<li>Lorem ipsum dolor consectetuer elit.</li>
<li>Phasellus nibh pellentesque congue.</li>
<li>Cras vitae metus aliquam pharetra.</li>
</ul>
</section>
<section class="6u">
<ul class="default">
<li>Pellentesque elit non gravida blandit.</li>
<li>Lorem ipsum dolor consectetuer elit.</li>
<li>Phasellus nibh pellentesque congue.</li>
<li>Cras vitae metus aliquam pharetra.</li>
</ul>
</section>
</div>
</section>
</div>
<div class="4u">
<section>
<header class="major">
<h2>Donec dictum metus</h2>
<span class="byline">Mattis wisi maecenas ligula</span>
</header>
<ul class="contact">
<li>
<span class="address">Address</span>
<span>1234 Somewhere Road #4285 <br />Nashville, TN 00000</span>
</li>
<li>
<span class="mail">Mail</span>
<span>someone#untitled.tld</span>
</li>
<li>
<span class="phone">Phone</span>
<span>(000) 000-0000</span>
</li>
</ul>
</section>
</div>
</div>
<!-- Copyright -->
<div class="copyright">
Design: TEMPLATED Images: Unsplash (CC0)
</div>
</div>
</div>
<a id="middle"></a>
</body>
</html>
thanks
Just use white-space: nowrap on the text element to make the text stay on the same line regardless of the parents size.
And for the images, you need to either add margin or padding on the parent container.
i.e,
.4u p {
white-space: nowrap;
}
and
.4u{
padding: 0.23em;
}
or
.4u{
margin: 0.23em;
}
apparently the footer background went missing too
Edited:
This is the changes I made to your code
.flex {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.flex-item + .flex-item {
margin-top: 30px;
}
.image.feature2 {
display: block;
margin: 0 0 7em 0;
}
<div class="row no-collapse-1">
<div class="flex">
<section class="flex-item">
<a class="image feature2"><img
src="https://abrilexame.files.wordpress.com/2016/09/size_960_16_9_google-robert-bunsen.jpg" align="left" =""></a>
<p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p>
</section>
<section class="flex-item">
<a class="image feature2"><img src="https://eduardhosp-alemao.com.br/wp-content/uploads/2018/05/Hashtag-Google-Alem%C3%A3o-Sem-Complica%C3%A7%C3%A3o.jpg" align="left"></a>
<p>Curabitur sem urna, consequat vel, suscipit convallis sem leo, mattis placerat, nulla. Sed ac leo.</p>
</section>

Footer on the bottom of the page and stop moving the text while hovering over dropdown menu

I'm trying to make my footer to be always displayed on the bottom of the page when there is no enough content. I've tried several solutions but none of them worked. Also, there is a small issue with the dropdown menu - the text moves when I hover over this component. What should I change in my CSS? Thanks!
$(document).ready(function(){
$('li').hover(function(){
$(this).find('ul>li').stop().slideToggle(250);
});
});
body {
font-family: 'Roboto Condensed', sans-serif;
font-size: 18px;
color: #333;
}
p {
padding: 10px;
}
#navigation ul {
margin: 0;
padding: 0;
width: auto;
list-style-type: none;
text-align: center;
display: inline-block;
}
#navigation {
text-align: center;
}
#navigation ul li {
float: left;
font-weight: bold;
font-size: 20px;
line-height: 40px;
text-align: center;
text-shadow: 1px 1px 1px #000;
width: 140px;
}
#navigation ul li:hover {
background: #9D9FA4;
border-radius: 10px;
}
ul li a {
text-decoration: none;
color: #FFFFFF;
}
ul li li {
background: #3F61A9;
color: #fff;
display: none;
}
ul li li:hover {
background: #9D9FA4;
}
ul li li a{
text-decoration: none;
color: #fff;
}
#wrapper {
margin: 0 auto;
width: 1000px;
}
#headerwrap {
width: 1000px;
float: left;
margin: 0 auto;
position: relative;
}
#header {
height: 125px;
background: #000000;
border-radius: 10px;
border: 1px solid #000000;
margin: 5px;
position: relative;
}
#navigationwrap {
width: 1000px;
float: left;
margin: 0 auto;
position: relative;
}
#navigation {
height: 40px;
background: #52bf6e;
border-radius: 10px;
border: 1px solid #3ea858;
margin: 5px;
}
#contentwrap {
width: 700px;
float: left;
margin: 0 auto;
}
#content {
background: #FFFFFF;
border-radius: 10px;
margin: 5px;
}
#leftcolumnwrap {
width: 150px;
float: left;
margin: 0 auto;
}
#leftcolumn {
border-radius: 10px;
margin: 5px;
}
#rightcolumnwrap {
width: 150px;
float: left;
margin: 0 auto;
}
#rightcolumn {
border-radius: 10px;
margin: 5px;
}
#footerwrap {
width: 1000px;
float: left;
margin: 0 auto;
clear: both;
}
#footer {
height: 40px;
background: #9D9FA4;
border-radius: 10px;
border: 1px solid #888a91;
margin: 5px;
background-color: #9D9FA4;
text-align: center;
color: #FFFFFF;
font-weight: bold;
}
#navigationwrap_placeholder {
display:none;
height: 40px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div id="wrapper">
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap">
<div id="navigation">
<ul>
<li>main menu</li>
<li><a>test</a>
<ul class="sub-menu">
<li>test1</li>
<li>test2</li>
<li>test3</li>
<li>test4</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="navigationwrap_placeholder"></div>
<div id="leftcolumnwrap">
<div id="leftcolumn">
<p></p>
</div>
</div>
<div id="contentwrap">
<div id="content">
<br><br>
<p>Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. </p>
<br><br>
</div>
</div>
<div id="rightcolumnwrap">
<div id="rightcolumn">
<p></p>
</div>
</div>
<div id="footerwrap">
<div id="footer">
</div>
</div>
</div>
</body>
</html>
You need to use position:fixed to put the footer at the bottom of the page.
#footerwrap {
width: 1000px;
margin: 0 auto;
position: fixed;
bottom:0;
}
As for the text shifting slideToggle seems to be shifting the padding of the test list item. By setting the padding in the style itself it fixes the problem.
<li ><a style="padding:0 38%">test</a>
Here is a working snippet that solves your navigation issue. I added comments in the CSS so you can better understand what changes I made. I used some flex-box to fix the issue. Super simple. As for the footer, there are lots of ways you can achieve this so I will post a link to an article that shows you 5 different ways to do it and you can pick whichever one works best for your use case. Hope this helps :)
P.S. As a side note, I noticed in your markup that you had a class called sub-menu which is not being used in your CSS. Not a big deal just thought I'd point it out. You probably have plans for it later on.
Here are some footer options
$(document).ready(function() {
$('li').hover(function() {
$(this).find('ul>li').stop().slideToggle(250);
});
});
body {
font-family: 'Roboto Condensed', sans-serif;
font-size: 18px;
color: #333;
}
p {
padding: 10px;
}
/* removed display property as it was not needed
display inline-block was causing the nav item to shift over*/
#navigation ul {
margin: 0;
padding: 0;
width: auto;
list-style-type: none;
}
#navigation {
text-align: center;
}
#navigation ul li {
float: left;
font-weight: bold;
font-size: 20px;
line-height: 40px;
text-align: center;
text-shadow: 1px 1px 1px #000;
width: 140px;
}
#navigation ul li:hover {
background: #9D9FA4;
border-radius: 10px;
}
ul li a {
text-decoration: none;
color: #FFFFFF;
}
ul li li {
background: #3F61A9;
color: #fff;
display: none;
}
ul li li:hover {
background: #9D9FA4;
}
ul li li a {
text-decoration: none;
color: #fff;
}
#wrapper {
margin: 0 auto;
width: 1000px;
}
#headerwrap {
width: 1000px;
float: left;
margin: 0 auto;
position: relative;
}
#header {
height: 125px;
background: #000000;
border-radius: 10px;
border: 1px solid #000000;
margin: 5px;
position: relative;
}
#navigationwrap {
width: 1000px;
float: left;
margin: 0 auto;
position: relative;
}
/* Added display flex to container with
justify-content center to keep nav items aligned*/
#navigation {
height: 40px;
background: #52bf6e;
border-radius: 10px;
border: 1px solid #3ea858;
margin: 5px;
display: flex;
justify-content: center
}
#contentwrap {
width: 700px;
float: left;
margin: 0 auto;
}
#content {
background: #FFFFFF;
border-radius: 10px;
margin: 5px;
}
#leftcolumnwrap {
width: 150px;
float: left;
margin: 0 auto;
}
#leftcolumn {
border-radius: 10px;
margin: 5px;
}
#rightcolumnwrap {
width: 150px;
float: left;
margin: 0 auto;
}
#rightcolumn {
border-radius: 10px;
margin: 5px;
}
#footerwrap {
width: 1000px;
float: left;
margin: 0 auto;
clear: both;
}
#footer {
height: 40px;
background: #9D9FA4;
border-radius: 10px;
border: 1px solid #888a91;
margin: 5px;
background-color: #9D9FA4;
text-align: center;
color: #FFFFFF;
font-weight: bold;
}
#navigationwrap_placeholder {
display: none;
height: 40px;
}
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div id="wrapper">
<div id="headerwrap">
<div id="header">
</div>
</div>
<div id="navigationwrap">
<div id="navigation">
<ul>
<li>main menu</li>
<li><a>test</a>
<ul class="sub-menu">
<li>test1</li>
<li>test2</li>
<li>test3</li>
<li>test4</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="navigationwrap_placeholder"></div>
<div id="leftcolumnwrap">
<div id="leftcolumn">
<p></p>
</div>
</div>
<div id="contentwrap">
<div id="content">
<br>
<br>
<p>Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices.
Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci
luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. </p>
<br>
<br>
</div>
</div>
<div id="rightcolumnwrap">
<div id="rightcolumn">
<p></p>
</div>
</div>
<div id="footerwrap">
<div id="footer">
</div>
</div>
</div>
</body>
</html>

placing a link (a) aligned bottom with his container (li)

I have the following view : https://jsfiddle.net/jcrqhqLq/
I'd like to align the "Add to cart" buttons to the bottom of their container, so the buttons of every plans are all horizontally aligned, but I can't manage to do it. I tried to add position: absolute; bottom 0; on the buttons, but it breaks the container.
How can I do it ?
Try by adding this in your code
.pricing-table .plan{position:relative;}
li.plan-feature:last-child {
min-height: 65px;
}
li.plan-feature:last-child a {
bottom: 10px;
display: block;
left: 0;
margin-left: auto;
margin-right: auto;
position: absolute;
right: 0;
width: 95px;
}
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.pricing-table .plan {
background-color: #f3f3f3;
border-radius: 5px;
box-shadow: 0 0 6px 2px #b0b2ab;
text-align: center;
height: 100%;
}
.pricing-table .plan:hover {
background: #fff;
box-shadow: 0 0 12px 3px #b0b2ab;
}
.pricing-table .plan .plan-name {
background-color: #5e5f59;
border-radius: 5px 5px 0 0;
color: #fff;
padding: 20px;
}
.pricing-table .plan:hover .plan-name {
background: #4e9a06;
}
.pricing-table .plan .plan-name span {
font-size: 20px;
}
.pricing-table .plan ul {
border-radius: 0 0 5px 5px;
list-style: outside none none;
margin: 0;
padding: 0;
}
.pricing-table .plan h2 {
margin: 10px 0;
}
.pricing-table .plan ul li.plan-feature {
border-top: 1px solid #c5c8c0;
padding: 15px 10px;
}
.pricing-table .plan ul li.plan-feature .plan-feature-description {
margin: 0;
color: #777;
font-size: .9em;
}
.pricing-table .plan{position:relative;}
li.plan-feature:last-child {
min-height: 65px;
}
li.plan-feature:last-child a {
bottom: 10px;
display: block;
left: 0;
margin-left: auto;
margin-right: auto;
position: absolute;
right: 0;
width: 95px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row row-eq-height pricing-table">
<div class="col-xs-12 col-md-4">
<div class="plan">
<div class="plan-name">
<h2>Plan #1</h2>
<span>24.90 €</span>
</div>
<ul>
<li class="plan-feature">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis tincidunt, urna et hendrerit rutrum, dui eros efficitur massa, at mattis justo tortor eget nisl.</li>
<li class="plan-feature">
Feature #1
<p class="plan-feature-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</li>
<li class="plan-feature">Add to cart</li>
</ul>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="plan">
<div class="plan-name">
<h2>Plan #2</h2>
<span>39.90 €</span>
</div>
<ul>
<li class="plan-feature">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis tincidunt, urna et hendrerit rutrum, dui eros efficitur massa, at mattis justo tortor eget nisl.</li>
<li class="plan-feature">
Feature #1
<p class="plan-feature-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</li>
<li class="plan-feature">
Feature #2
<p class="plan-feature-description">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</li>
<li class="plan-feature">Add to cart</li>
</ul>
</div>
</div>
</div>
You can adjust the padding in your css code to put the buttons at the bottom:
.pricing-table .plan ul li.plan-feature {
border-top: 1px solid #c5c8c0;
padding: 15px 10px 0 10px;
}

Resources