How to make floating divs and equal height - html

First of all, this is my code for the web page
#import url("reset.css");
#import url('https://fonts.googleapis.com/css?family=Raleway');
*
{
box-sizing:border-box;
}
body
{
background-color: #9E9E9E;
}
#wrapper
{
width:95%;
max-width:980px;
margin: 0 auto;
font-family: 'Raleway', sans-serif;
line-height: 2rem;
}
.header
{
padding:18px;
background-color: #757575;
border-radius:5px;
width:100%;
margin-top:5px;
margin-bottom:5px;
}
.column_left
{
float:left;
padding:18px;
width:70% ;
background-color:#607D8B;
border-top-left-radius: 5px;
border-bottom-left-radius:5px;
}
.column_right
{
float:right;
padding:18px;
width:29.99%;
background-color:#455A64;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
/*For Screens 750 PX or less (width)*/
#media screen and (max-width:750px)
{
.header
{
text-align:center;
}
.column_right
{
display:none;
}
.column_left
{
width:100%;
border-radius:5px;
}
}
h1
{
font-size:1.8rem;
}
h2
{
font-size: 1.4rem;
}
p
{
}
nav
{}
nav ul
{}
nav ul li
{
width:100%;
background-color:#607D8B;
text-align:center;
padding:2.5px;
border-radius:5px;
margin-bottom:5px;
}
nav ul li a
{
color:#455A64;
}
footer
{
padding:18px;
background-color: #757575;
border-radius:5px;
width:100%;
margin-top:5px;
margin-bottom:5px;
float:none;
display:flex;
}
<meta name="viewport" content="width=device-width, user-scalable=no">
<div id="wrapper">
<h1 class="header">Lorem Ipsum</h1>
<div class="column_left">
<h2>Welcome to Lorem Ipsum</h2>
<p>Aenean nec vestibulum justo, ut aliquet ante. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Etiam viverra interdum neque, sed sagittis lectus sodales sit amet.</p>
<p>Maecenas posuere laoreet auctor. Integer vel nulla ut magna interdum consectetur.</p>
<p>Vestibulum non ligula sed diam luctus tincidunt in sit amet metus.</p>
</div>
<div class="column_right">
<h2>Navigation</h2>
<nav>
<ul>
<li><a class="button" href="#">Link</a></li>
<li><a class="button" href="#">Link</a></li>
<li><a class="button" href="#">Link</a></li>
</ul>
</nav>
</div>
<footer>
© 2016 Ipsum Lorem
</footer>
</div>
Basically I would like to have the column_left and column_right classes the same height, without using height=100%. The website will have more than one page, and the length on the others may not be the same as the example page. Here is an image of what I got so far:
Basically, I want the navigation div to be as tall as the one beside it.

If flexbox is an option, you can give:
display: flex;
flex-wrap: wrap;
to wrapper and that will fix the heights - see demo below:
#import url("reset.css");
#import url('https://fonts.googleapis.com/css?family=Raleway');
* {
box-sizing: border-box;
}
body {
background-color: #9E9E9E;
}
#wrapper {
width: 95%;
max-width: 980px;
margin: 0 auto;
font-family: 'Raleway', sans-serif;
line-height: 2rem;
display: flex;
flex-wrap: wrap;
}
.header {
padding: 18px;
background-color: #757575;
border-radius: 5px;
width: 100%;
margin-top: 5px;
margin-bottom: 5px;
}
.column_left {
float: left;
padding: 18px;
width: 70%;
background-color: #607D8B;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
.column_right {
float: right;
padding: 18px;
width: 29.99%;
background-color: #455A64;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
/*For Screens 750 PX or less (width)*/
#media screen and (max-width: 750px) {
.header {
text-align: center;
}
.column_right {
display: none;
}
.column_left {
width: 100%;
border-radius: 5px;
}
}
h1 {
font-size: 1.8rem;
}
h2 {
font-size: 1.4rem;
}
p {} nav {} nav ul {} nav ul li {
width: 100%;
background-color: #607D8B;
text-align: center;
padding: 2.5px;
border-radius: 5px;
margin-bottom: 5px;
}
nav ul li a {
color: #455A64;
}
footer {
padding: 18px;
background-color: #757575;
border-radius: 5px;
width: 100%;
margin-top: 5px;
margin-bottom: 5px;
float: none;
display: flex;
}
<div id="wrapper">
<h1 class="header">Lorem Ipsum</h1>
<div class="column_left">
<h2>Welcome to Lorem Ipsum</h2>
<p>Aenean nec vestibulum justo, ut aliquet ante.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Etiam viverra interdum neque, sed sagittis lectus sodales sit amet.</p>
<p>Maecenas posuere laoreet auctor. Integer vel nulla ut magna interdum consectetur.</p>
<p>Vestibulum non ligula sed diam luctus tincidunt in sit amet metus.</p>
</div>
<div class="column_right">
<h2>Navigation</h2>
<nav>
<ul>
<li><a class="button" href="#">Link</a>
</li>
<li><a class="button" href="#">Link</a>
</li>
<li><a class="button" href="#">Link</a>
</li>
</ul>
</nav>
</div>
<footer>
© 2016 Ipsum Lorem
</footer>
</div>

If you can't use flexbox, which is the recommended way, and you don't want script, here is 2 options:
Since both float: right and position: absolute takes the element out of flow (in their own way), the latter will solve your problem if the left column is always higher. With an added wrapper (columns) it could look like this
#import url("reset.css");
#import url('https://fonts.googleapis.com/css?family=Raleway');
*
{
box-sizing:border-box;
}
body
{
background-color: #9E9E9E;
}
#wrapper
{
width:95%;
max-width:980px;
margin: 0 auto;
font-family: 'Raleway', sans-serif;
line-height: 2rem;
}
.header
{
padding:18px;
background-color: #757575;
border-radius:5px;
width:100%;
margin-top:5px;
margin-bottom:5px;
}
.columns
{
position: relative;
}
.columns::after
{
content: '';
display:block;
clear:both;
}
.column_left
{
float:left;
padding:18px;
width:70% ;
background-color:#607D8B;
border-top-left-radius: 5px;
border-bottom-left-radius:5px;
}
.column_right{
position: absolute;
top: 0;
right: 0;
padding:18px;
width:30%;
background-color:#455A64;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
height: 100%;
}
/*For Screens 750 PX or less (width)*/
#media screen and (max-width:750px)
{
.header
{
text-align:center;
}
.column_right
{
display:none;
}
.column_left
{
width:100%;
border-radius:5px;
}
}
h1
{
font-size:1.8rem;
}
h2
{
font-size: 1.4rem;
}
p
{
}
nav
{}
nav ul
{}
nav ul li
{
width:100%;
background-color:#607D8B;
text-align:center;
padding:2.5px;
border-radius:5px;
margin-bottom:5px;
}
nav ul li a
{
color:#455A64;
}
footer
{
padding:18px;
background-color: #757575;
border-radius:5px;
width:100%;
margin-top:5px;
margin-bottom:5px;
float:none;
display:flex;
}
<meta name="viewport" content="width=device-width, user-scalable=no">
<div id="wrapper">
<h1 class="header">Lorem Ipsum</h1>
<div class="columns">
<div class="column_left">
<h2>Welcome to Lorem Ipsum</h2>
<p>Aenean nec vestibulum justo, ut aliquet ante. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Etiam viverra interdum neque, sed sagittis lectus sodales sit amet.</p>
<p>Maecenas posuere laoreet auctor. Integer vel nulla ut magna interdum consectetur.</p>
<p>Vestibulum non ligula sed diam luctus tincidunt in sit amet metus.</p>
</div>
<div class="column_right">
<h2>Navigation</h2>
<nav>
<ul>
<li><a class="button" href="#">Link</a></li>
<li><a class="button" href="#">Link</a></li>
<li><a class="button" href="#">Link</a></li>
</ul>
</nav>
</div>
</div>
<footer>
© 2016 Ipsum Lorem
</footer>
</div>
Use display: table. With an added wrapper (columns) it could look like this:
(I favor this before the above as it is dynamic and keep both columns equal high regardless of which one is higher.)
#import url("reset.css");
#import url('https://fonts.googleapis.com/css?family=Raleway');
*
{
box-sizing:border-box;
}
body
{
background-color: #9E9E9E;
}
#wrapper
{
width:95%;
max-width:980px;
margin: 0 auto;
font-family: 'Raleway', sans-serif;
line-height: 2rem;
}
.header
{
padding:18px;
background-color: #757575;
border-radius:5px;
width:100%;
margin-top:5px;
margin-bottom:5px;
}
.columns
{
display: table;
width: 100%;
}
.column_left
{
display: table-cell;
padding:18px;
width:70%;
background-color:#607D8B;
border-top-left-radius: 5px;
border-bottom-left-radius:5px;
}
.column_right{
display: table-cell;
padding:18px;
width:30%;
background-color:#455A64;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
/*For Screens 750 PX or less (width)*/
#media screen and (max-width:750px)
{
.header
{
text-align:center;
}
.column_right
{
display:none;
}
.column_left
{
width:100%;
border-radius:5px;
}
}
h1
{
font-size:1.8rem;
}
h2
{
font-size: 1.4rem;
}
p
{
}
nav
{}
nav ul
{}
nav ul li
{
width:100%;
background-color:#607D8B;
text-align:center;
padding:2.5px;
border-radius:5px;
margin-bottom:5px;
}
nav ul li a
{
color:#455A64;
}
footer
{
padding:18px;
background-color: #757575;
border-radius:5px;
width:100%;
margin-top:5px;
margin-bottom:5px;
float:none;
display:flex;
}
<meta name="viewport" content="width=device-width, user-scalable=no">
<div id="wrapper">
<h1 class="header">Lorem Ipsum</h1>
<div class="columns">
<div class="column_left">
<h2>Welcome to Lorem Ipsum</h2>
<p>Aenean nec vestibulum justo, ut aliquet ante. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Etiam viverra interdum neque, sed sagittis lectus sodales sit amet.</p>
<p>Maecenas posuere laoreet auctor. Integer vel nulla ut magna interdum consectetur.</p>
<p>Vestibulum non ligula sed diam luctus tincidunt in sit amet metus.</p>
</div>
<div class="column_right">
<h2>Navigation</h2>
<nav>
<ul>
<li><a class="button" href="#">Link</a></li>
<li><a class="button" href="#">Link</a></li>
<li><a class="button" href="#">Link</a></li>
</ul>
</nav>
</div>
</div>
<footer>
© 2016 Ipsum Lorem
</footer>
</div>

Per this similar question, you can achieve this using JavaScript.
document.getElementsByClassName("column_left")[0].style.height = document.getElementsByClassName("column_right")[0].style.height;
This will set the left column's height to the right column's height. You can switch around the code, and use the question's answers too.

Related

How can I make a card like this

So I have this card where the title of it"DcBlog" is in the same line with the content "My Cool Server", I don't want it like that ,but I can't solve this problem
.cards div:first-child {
border-radius: 10px 10px 0 0;
}
.cards div:last-child {
border-radius: 0 0 10px 10px;
margin-bottom:10px;
}
.card {
background-color: #212121;
border-radius:0 0 0 0;
}
.card .btn {
background-color:#d41950;
color:white;
outline:none;
border: none;
}
.card-title {
color:#d89e45;
margin-left:10px;
}
.card-top{
display: flex;
align-items:center;
}
.card-icon {
width:100px;
height:100px;
border-radius:50%;
}
<div class="card" style="width: 100%">
<div class="card-body">
<div class="card-top">
<img class="card-icon" src="https://cdn.discordapp.com/icons/888480205709144084/157cff143fe47dbf7d291a37dc6164dd.png">
<h5 class="card-title">dcblog</h5>
<div class="container">
<p class="card-text">My Cool Server</p>
</div>
</div>
Go somewhere
</div>
</div>
and I want to make the title and the content of the card in different lines,like this one:
how can I do that?
I believe this Fiddle does what you want.
Essentially, you want to use Flexbox for the left part.
Right part will stack naturally.
HTML
<div class="card">
<div class="left-side">
<img src="https://cdn.discordapp.com/icons/888480205709144084/157cff143fe47dbf7d291a37dc6164dd.png"/> Go somewhere
</div>
<div class="right-side">
<div class="top">
<h1>Dcblog</h1>
<h2>My cool server</h2>
</div>
<div class="bot">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut nunc nisl, luctus a magna sit amet, pharetra euismod tortor. Suspendisse ut eros nisl. Morbi luctus lacus sit amet consectetur suscipit. Suspendisse vitae est erat. Integer in tincidunt tortor.
</p>
</div>
</div>
</div>
CSS
.card {
display: flex;
padding: 10px;
background-color: #212121;
}
.left-side {
display: flex;
flex-direction: column;
align-items: center;
}
.left-side > a {
color: #FFF;
background-color: #d41950;
width: 100%;
margin-top: 10px;
text-align: center;
text-decoration: none;
padding-top: 5px;
padding-bottom: 5px;
}
.right-side {
padding-left: 10px;
}
.top > h1 {
margin: 0;
color: #d89e45;
}
.top > h2 {
margin: 0;
color: #FFF;
}
.bot > p {
color: #DDD;
}

Making a footer stay at the bottom of the page both in mobile view and desktop view

In mobile view, the footer is not remaining at at the bottom of the page. It stays somewhere above the bottom. I want the footer to stay at the bottom always in mobile view and desktop view. But the footer should not be visible always, if the site has much contents, user will have to scroll down to see the footer. What changes do I need to make in the css file to make the footer stay at the bottom of the page always?
html { height: 100%; }
body {
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
color:#303036;
margin:0px;
background:url('../images/diagonal_noise.png');
background-repeat:repeat;
min-width:1100px;
overflow:auto;
height:100%;
}
#mainPart{
margin:0 auto;
}
.container{
overflow:hidden;
clear:both;
max-width:1080px;
margin:20px auto 40px auto;
}
footer {
color: white;
width:100%;
padding:0;
display:block;
clear:both;
height: 40px; /* added */
}
.footrow{
overflow:hidden;
background-color: #111;
display:block;
}
.footrow2{
overflow:hidden;
background-color: #002c42;
display:block;
padding:15px;
}
.foot{
max-width:1080px;
margin:0 auto;
font-size:11px;
line-height:18px;
}
.foot-p{
font-weight: 600;
padding:2px;
color:#66e355 !important;
}
.half-width {
width: 50%;
float:left;
}
.quarter-width {
width: calc(25% - 30px);
float:left;
padding:15px;
}
#social2 {
display: block;
background-color: transparent;
float: left;
margin: 0 auto;
}
.sc-icn2 {
width: 50px;
height: 50px;
display: block;
margin-right: 5px;
margin-bottom: 5px;
float: left;
}
<html>
<head>
</head>
<body>
<div id="mainPart">
</div>
<div class="container">
</div>
<footer>
<div class="footrow" >
<div class="foot">
<div class="quarter-width">
<div>
</div>
</div>
<div class="quarter-width">
</div>
<div class="quarter-width">
<div id="social2">
</div>
</div>
<div class="quarter-width">
</div>
</div>
</div>
<div class="footrow2" >
<div class="foot">
<div class="half-width">
</div>
<div class="half-width">
</div>
</div>
</div>
</footer>
</body>
</html>
To achieve that result define the footer position to bottom. position: absolute; bottom: 0;
The position property specifies the type of positioning method used for an element. The absolute element is positioned relative to its first positioned ancestor element which is the body As you can see in body css rule the element is positioned relative to its normal position.
More about position property can be found here.
html {
position: relative;
min-height: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
overflow-x: hidden;
margin: 0px;
position: relative;
min-height: 100%;
height: auto;
}
.demo {
margin: 0 auto;
padding-top: 64px;
max-width: 640px;
width: 94%;
}
.demo h1 {
margin-top: 0;
}
/**
* Footer Styles
*/
.footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
padding: 1rem;
background-color: #34495e;
color:#fff;
text-align: center;
}
<div class="demo">
<h1>Footer Stays Bottom</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque congue nunc at ex ultricies molestie. Cras in tempor turpis. Suspendisse et aliquam nisl. Vestibulum semper nibh at nibh dignissim, ac dapibus lorem facilisis. Donec rhoncus lacus sit amet risus dapibus sollicitudin. Ut vitae auctor dolor, et molestie nunc. Maecenas iaculis ante in tincidunt finibus. Etiam vehicula odio a lorem varius sagittis. Suspendisse sed purus at justo porta blandit quis at quam. Sed vitae faucibus nulla. Sed tincidunt tellus sapien, eu pulvinar nisi suscipit sed. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec eget felis ultricies, iaculis est eu, posuere nulla.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque congue nunc at ex ultricies molestie. Cras in tempor turpis. Suspendisse et aliquam nisl. Vestibulum semper nibh at nibh dignissim, ac dapibus lorem facilisis. Donec rhoncus lacus sit amet risus dapibus sollicitudin. Ut vitae auctor dolor, et molestie nunc. Maecenas iaculis ante in tincidunt finibus. Etiam vehicula odio a lorem varius sagittis. Suspendisse sed purus at justo porta blandit quis at quam. Sed vitae faucibus nulla. Sed tincidunt tellus sapien, eu pulvinar nisi suscipit sed. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec eget felis ultricies, iaculis est eu, posuere nulla.</p>
</div>
<div class="footer">This footer will always be positioned at the bottom of the page, but <strong>not fixed</strong>.</div>
To make the footer stay at bottom of the page, you simply have to add position: absolute; and bottom: 0; in the block of CSS that applies to footer. So it will become:
footer{
color: white;
width:100%;
padding:0;
display:block;
clear:both;
height: 40px; /* added */
position: absolute;
bottom: 0;
}
You can do this by many ways:
There is negative bottom margins on wrappers
There was a wrapping element that held everything except the footer. It had a negative margin equal to the height of the footer.
* {
box-sizing: border-box;
}
html, body {
height: 100%;
margin: 0;
}
.content {
padding: 20px;
min-height: 100%;
margin: 0 auto -50px;
}
.footer,
.push {
height: 50px;
}
footer {
background: #42A5F5;
color: white;
line-height: 50px;
padding: 0 20px;
}
<div class="content">
<h1>Sticky Footer with Negative Margin 1</h1>
</div>
<footer class="footer">
Footer
</footer>
Negative top margins on footers
This technique did not require a push element, but instead, required an extra wrapping element around the content in which to apply matching bottom padding to. Again to prevent negative margin from lifting the footer above any content.
html, body {
height: 100%;
margin: 0;
}
.content {
min-height: 100%;
}
.content-inside {
padding: 20px;
padding-bottom: 50px;
}
.footer {
height: 50px;
margin-top: -50px;
background: red;
}
<div class="content">
<div class="content-inside">
content
</div>
</div>
<footer class="footer"></footer>
There is calc() reduced height wrappers
* {
box-sizing: border-box;
}
body {
margin: 0;
}
.content {
min-height: calc(100vh - 70px);
padding: 40px 40px 0 40px;
}
.footer {
height: 50px;
background: #42A5F5;
color: white;
line-height: 50px;
padding: 0 20px;
}
<div class="content">
<h1>Sticky Footer with calc()</h1>
</div>
<footer class="footer">
Footer
</footer>
And also you can use flexbox
html {
height: 100%;
}
body {
display: flex;
flex-direction: column;
height: 100vh;
}
.content {
flex: 1 0 auto;
padding: 20px;
}
.footer {
flex-shrink: 0;
padding: 20px;
background: #42A5F5;
color: white;
}
<div class="content">
<h1>Sticky Footer with Flexbox</h1>
</div>
<footer class="footer">
Footer
</footer>
This works for you. Try it.
For that add enough content in side the .container div.
And add min-height value to .container as below.
body {
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
color:#303036;
margin:0px;
background:url('../images/diagonal_noise.png');
background-repeat:repeat;
min-width:100%;
overflow:auto;
height:100%;
}
.container{
overflow:hidden;
clear:both;
max-width:1080px;
margin:20px auto 40px auto;
/*new style*/
min-height:768px;
}
#media only screen and (max-width: 768px) {
.container{
max-width: 80%;
margin:20px auto 40px auto;
min-height:480px;
}
}
html { height: 100%; }
body {
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
color:#303036;
margin:0px;
background:url('../images/diagonal_noise.png');
background-repeat:repeat;
min-width:100%;
overflow:auto;
height:100%;
}
#mainPart{
margin:0 auto;
}
.container{
overflow:hidden;
clear:both;
max-width:1080px;
margin:20px auto 40px auto;
min-height:768px;
}
footer {
color: white;
width:100%;
padding:0;
display:block;
clear:both;
height: 40px; /* added */
}
.footrow{
overflow:hidden;
background-color: #111;
display:block;
}
.footrow2{
overflow:hidden;
background-color: #002c42;
display:block;
padding:15px;
}
.foot{
max-width:1080px;
margin:0 auto;
font-size:11px;
line-height:18px;
}
.foot-p{
font-weight: 600;
padding:2px;
color:#66e355 !important;
}
.half-width {
width: 50%;
float:left;
}
.quarter-width {
width: calc(25% - 30px);
float:left;
padding:15px;
}
#social2 {
display: block;
background-color: transparent;
float: left;
margin: 0 auto;
}
.sc-icn2 {
width: 50px;
height: 50px;
display: block;
margin-right: 5px;
margin-bottom: 5px;
float: left;
}
#media only screen and (max-width: 768px) {
.container{
max-width: 80%;
margin:20px auto 40px auto;
min-height:480px;
}
}
<html>
<head>
</head>
<body>
<div id="mainPart"></div>
<div class="container">
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
<footer>
<div class="footrow" >
<div class="foot">
<div class="quarter-width">
<div>
</div>
</div>
<div class="quarter-width">
</div>
<div class="quarter-width">
<div id="social2">
</div>
</div>
<div class="quarter-width">
</div>
</div>
</div>
<div class="footrow2">
<div class="foot">
<div class="half-width">
</div>
<div class="half-width">
</div>
</div>
</div>
</footer>
</body>
</html>

How can i make li elements be at the same level if the number or li elements is odd

I want the left li elemts to be at the same level with the ones in the right, here is the code: https://jsfiddle.net/v5m6cv1u/
<div class="menu">
</p>Code too long<p>
</div>
.menu h2 {
text-align: center;
font-size: 4vh;
text-transform: uppercase;
}
.menu h3 {
font-size: 3vh;
color: darkblue
}
.menu h4 {
padding: 0.2em 0em;
}
.menu .content {
padding: 3em 5em;
}
.ipsum {
list-style: none;
padding-bottom: 1em;
border-bottom: 1px solid #000000;
}
.menu p {
font-size: 1em;
}
.menu .vitae {
text-align: right;
color: brown
}
.meniu .vitae:after {
content: " VIT";
}
.menu .magna {
text-align: right;
color: darkslateblue;
font-size: 1.2em;
}
.menu .magna:after {
content: " MAG";
}
.menu ul {
columns: 2;
padding: 0;
margin: 0;
display: inline-block;
width: 100%;
}
.menu ul li {
display: inline-block;
}
.menu {
background-color: #FFFAE7;
}
.menu h1 {
color: #d00807;
font-size: 6em;
display: block;
text-align: center;
padding-top: 0.2em;
padding-bottom: 0.1em;
text-transform: uppercase;
}
<div class="menu">
<h1>Lorem ipsum</h1>
<h2>Lorem ipsum dolor sit amet, et denique molestiae sit. </h2>
<div class="content">
<h3>Lorem</h3>
<ul>
<li class="ipsum dolor">
<h4>Dolor</h4>
<p>Nullam consequat, sem vitae rhoncus tristique, mauris nulla fermentum est, bibendum ullamcorper sapien magna et quam.</p>
<div class="vitae">9.5</div>
<div class="magna">320</div>
</li>
<li class="ipsum sit">
<h4>Sit</h4>
<p>Nullam consequat, sem vitae rhoncus tristique, mauris nulla fermentum est, bibendum ullamcorper sapien magna et quam.</p>
<div class="vitae">9.5</div>
<div class="magna">320</div>
</li>
<li class="ipsum amet">
<h4>Amet</h4>
<p>Nullam consequat, sem vitae rhoncus tristique, mauris nulla fermentum est, bibendum ullamcorper sapien magna et quam.</p>
<div class="vitae">9.5</div>
<div class="magna">320</div>
</li>
</ul>
</div>
</div>
Instead of using columns on the ul, you could use this CSS on the lielements (it results in a different order, I don't know if that's okay for you?):
.menu ul li {
display: inline-block;
width: 45%;
box-sizing: border-box;
margin-right: 4%;
}
https://jsfiddle.net/w6br9r69/2/
Easy solution would be to make the element inline-block
.ipsum {
[...]
display: inline-block;
}

Responsive css is not responding

The Responsive.css is not completed yet but it is responding according to the device size. The issues that are arising are that when I resize the the screen, the right section with header Memorial, an image below, and some text are not stacking correctly when the screen shrinks in size. Instead, it will be pushed down but remain on the right handside of the screen. Also have in issue with resizing the images I have displayed on my sites. I would like to resize accordingly with the size of the device. I have a logo image and a banner image and on top of these two images is the navigation bar which I am also having issue with resizing and making it transparent due to having the navigation bar on top of a grey background. How can I make it transparent on top of the banner and logo.
<img id="banner" src="img/banner.jpg"/>
<!--The main content of the website will go inside of the #wrapper id. It is divided into two sections: #primary & #secondary.-->
<div id="wrapper">
<!-- Two sections have been created for desktop view to have two columns. Mobile website will just be stacked-->
<div id="content">
<section id="primary"><!--Left column content goes here-->
<h2>Who We Are</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in elementum velit, venenatis rhoncus lacus. Ut consequat luctus enim, in auctor libero posuere ut. Curabitur vitae aliquet nisi. Etiam condimentum tincidunt venenatis. Fusce vel congue purus. Pellentesque ut eleifend ex. Nunc purus neque, aliquam vitae aliquam quis, accumsan id lacus. Nunc ac scelerisque magna. Etiam purus lorem, rutrum et ornare a, tincidunt non ipsum. Nullam blandit dui venenatis, malesuada felis a, porttitor purus.</p>
<p>This is how a link looks.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in elementum velit, venenatis rhoncus lacus. Ut consequat luctus enim, in auctor libero posuere ut. Curabitur vitae aliquet nisi. Etiam condimentum tincidunt venenatis. Fusce vel congue purus. Pellentesque ut eleifend ex. Nunc purus neque, aliquam vitae aliquam quis, accumsan id lacus. Nunc ac scelerisque magna. Etiam purus lorem, rutrum et ornare a, tincidunt non ipsum. Nullam blandit dui venenatis, malesuada felis a, porttitor purus.</p>
</section>
<section id="secondary"><!--Right column content goes here-->
<h2>Memorial</h2>
<img src="img/memorial_list.jpg"/>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in elementum velit, venenatis rhoncus lacus. Ut consequat luctus enim, in auctor libero posuere ut.</p>
</section>
</div>
</div>
<!--Footer still needs to be completed-->
<footer>
<div id="footer-right">
<ul><h3>ABOUT</h3>
<li>Contact Us</li>
<li>FAQ's</li>
<li>Site Map</li>
</ul>
<ul><h3>SUPPORT OUR CAUSE</h3>
<li>Donate</li>
<li>Volunteer</li>
<li>Fundraising Events</li>
</ul>
<ul><h3>FOLLOW US</h3>
<li>
<img src="img/facebook-icon.png" alt="Facebook Logo" class="social-icon">
<img src="img/instagram-icon.png" alt="Instagram Logo" class="social-icon">
<img src="img/twitter-icon.png" alt="Twitter Logo" class="social-icon"/>
<img src="img/pinterest-icon.png" alt="Pinterest Logo" class="social-icon"/>
</li>
</ul>
</div>
<div id="footer-left">
<p id="footer-slogan">BREAK THE <strong>SILENCE</strong> <br>AND <strong>CYCLE</strong> OF ABUSE</p>
<p id="copyright">Copyright© 2014 International Child Advocacy Network</p>
</div>
</footer>
Responsive CSS:
/*This is the placeholder for responsive CSS that we will implement for mobile design*/
/* Smartphones (portrait and landscape) ----------- */
#media screen and (min-device-width : 240px) and (max-device-width: 660px){
/* Styles */
#content{
float:left;
padding:0;
}
#body{
float:left;
font-family: 'Fabrica';
}
#logo {
margin-right:auto;
width: auto;
height: auto;
padding: 0;
}
#wrapper{
margin: 0 auto;
}
#wrapper p{
text-indent: 0;
}
#nav ul, nav a:visited{
position:relative;
display:none;
}
#nav a:hover {
display:block;
}
#nav li{
text-align:center;
width:100%;
}
#banner{
position:relative;
}
#footer{
font-family: 'Fabrica';
}
}
/* Desktops and laptops ----------- */
#media screen and (min-device-width: 1024px){
/* Styles */
#primary {
width: 50%;
float: left;
padding:10px;
}
#secondary {
width: 40%;
float: right;
padding:10px;
}
}
#font-face {
font-family: 'Fabrica';
font-style: normal;
font-weight: 100;
src: local('Fabrica'), local('Fabrica'), url(path/Fabrica.otf) format('otf');
}
Main CSS:
/***********************
GENERAL
***********************/
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
img {
max-width: 100%;
}
body {
/*font-family: 'Fabrica', 'Courier New';*/
font-family: 'Open Sans', sans-serif;
background-color:#e6e9ed;
color: #434a54;
}
#wrapper{
max-width:960px;
margin: 0 auto;
background-color: #f5f7fa;
overflow: auto; /*This fixed the wrapper background color problem that happened bc floating content*/
line-height: 1.8em;
}
#wrapper img {
border-radius:5px 20px 5px;
}
#wrapper p {
text-indent: 2.5em;
}
#banner {
margin-left: auto;
margin-right:auto;
padding: 0;
display:block;
clear:both;
}
#content {
padding:20px 40px;
padding-bottom:50px;
}
h1, h2, h3 {
font-family: 'Droid Serif', serif;
}
/***********************
HEADER - Top image strip above banner
***********************/
#logo {
text-align:right;
max-height:100%;
max-width:100%;
padding: 10px 0px 10px 30px;
}
#header {
background-image: url(../img/header.jpg);
background-repeat: no-repeat;
background-position: top;
margin: 0 auto;
max-width:960px;
}
/*Commented out for testing new header technique
#header {
margin-left: auto;
margin-right: auto;
padding: 0;
display: block;
clear: both;
font-family: 'Fabrica', Arial;
}
*******/
/***********************
NAVIGATION - Main site navigation
***********************/
nav{
background-color:#4888dc;
text-align:center;
color:blue;
max-width:960px;
margin: 0 auto;
text-align:center;
font-size:1.2em;
}
nav ul{
list-style:none;
margin:0 10px; /*Can be change later on in the design if it doesn't work*/
}
nav li{
/*Inline, mostly text. Appears in the same line, inline as the rest of the text. Block
pushes other items out of the page. Inline block maintains width and
height but is in line with other images*/
display:inline-block;
list-style:none;
padding: .4em 1.5em;
}
nav a {
font-weight: 800;
}
nav a:visited, nav a:link {
color:#f5f7fa;
text-decoration: none;
}
nav a:hover {
color:#0B108C;
text-decoration: none;
}
/**********************
FOOTER
**********************/
footer {
font-family: 'Open Sans', sans-serif;
max-width:950px;
background-color:#434a54;
font-size:0.75em;
clear:both;
color:#e6e9ed; overflow:auto;
margin: 0 auto;
padding:5px;
}
footer h3{
padding-left: .9em;
font-family: 'Open Sans', sans-serif;
}
footer ul {
display:inline-block;
list-style-type: none;
}
footer ul li{
list-style:none;
text-decoration:none;
margin-left: 1em;
}
footer ul li a{
color:#e6e9ed;
}
footer a:hover {
color:#FFFFFF; /*Change hover color to make it more prominent*/
}
/**********************
RIGHT SIDE OF FOOTER
**********************/
#footer-right {
float:right;
margin-right:15px;
}
.social-icon {
display:inline-block;
width:24px;
height:24px;
margin-bottom:22.7px; /*controls height of "follow us" in footer*/
padding:1px;
border-radius: 20%;
}
/**********************
LEFT SIDE OF FOOTER
**********************/
#footer-left {
float:left;
padding-left: 2em;
text-align:left;
font-size: 1.35em;
display:inline-block;
line-height: 1.5em;
}
#footer-slogan {
font-family: 'Georgia', 'Droid Serif', sans-serif;
}
#copyright{
font-size: .75em;
text-align:left;
margin-top: 5px;
display:inline-block;
font-family: 'Open Sans', sans-serif;
}
I use this media query for my responsive design that I use on marketing platform to blast out to users:
#media screen and (max-width: 000px), screen and (max-device-width: 000px)
this works on android, iphone4,5,6 and ipad +other tablets
Use min-width and max-width instead of min-device-width and max-device-width. Device width refers to the display's resolution, i.e. 1024x800, not the size of the window.

Unsure how to use border-bottom in CSS

what I'd like to achieve is a border-bottom 20px below my h1 tag in my sidebar and also have 20px of "white space" below my border-bottom. I'd also like to have this underneath my h1 tag in my content area.
Here's the link to what I have now
HTML:
<!-- SIDEBAR -->
<div id="sidebar">
<h1>Caul / Cbua</h1>
<div class="sidetext">
Lorem ipsumdolor sit amet, consectetur adipiscing elit. Nam laoreet mi c est dignissim, at auctor mi tristique.
</div>
<h1>Commit</h1>
<div class="sidelink">
<ul>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
</ul>
</div>
</div>
<!-- CONTENT -->
<div id="content">
<h1>News</h1>
<div class="article">
<img class="articleimg" src="../../Slicing Images/news images/caul.png" width="84" height="65" alt="caul" />
<h2>Lorem Ipsum</h2>
<h3>Friday, August 16th</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque a leo in lacus tempor egestas. Maecenas faucibus neque nisi, eu condimentum enim porta id. Suspendisse blandit sem tellus. Vivamus tristique, nunc faucibus pulvinar fringilla, sem ipsum molestie libero, id rhoncus turpis quam sit amet quam. </p>
</div>
<div class="article">
<img class="articleimg" src="../../Slicing Images/news images/caul.png" width="84" height="65" alt="caul" />
<h2>Lorem Ipsum</h2>
<h3>Friday, August 16th</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque a leo in lacus tempor egestas. Maecenas faucibus neque nisi, eu condimentum enim porta id. Suspendisse blandit sem tellus. Vivamus tristique, nunc faucibus pulvinar fringilla, sem ipsum molestie libero, id rhoncus turpis quam sit amet quam. </p>
</div>
</div>
CSS:
#sidebar {
background-color: #e7d9c9;
background-image: url('/imgs/map.png');
background-repeat: no-repeat;
position: absolute;
/* # */
height: 100%;
width: 318px;
float: left;
padding-bottom: 20px;
padding-top: 20px;
}
#sidebar h1 {
border-bottom: thick;
border-bottom-width: 75%;
}
.sidetext {
padding: 5px 20px;
font-size: 18px;
font-family: Helvetica Neue;
padding-bottom: 20px;
}
.sidelink {
padding-bottom: 20px;
margin: 0;
padding: 0;
width:300px;
}
.sidelink ul {
margin: 0;
padding: 0;
margin-left: 20px;
}
.sidelink li {
display: block;
list-style: none;
}
.sidelink li a {
display:block;
font-family: Helvetica Neue;
font-size:16px;
color:#FFF;
text-decoration:none;
background-color:#1e416f;
padding:5px;
border-left:10px solid #FFF;
padding-bottom: 20px;
}
.sidelink li a:hover {
border-left:14px solid #1e416f;
background-color:#e7d9c9;
color: #1e416f;
}
h5 {
font-family: Helvetica Neue: Light;
font-size: 24px;
color: #517f9c;
}
/* Content */
#content {
width: 642px;
float: right;
padding-top: 20px;
}
.article {
padding: 5px 20px;
}
.articleimg {
float: left;
padding-right: 25px;
}
Try this and see how you go
#sidebar h1 { border-bottom: 1px solid black; margin-bottom: 20px; }
h1 {
border-bottom: 20px solid #000000;
}
AND
h1 {
margin: 0 0 20px 0;
}
OR
h1 {
margin-bottom: 20px;
}
Combine both rules though... So more like this:
h1 {
margin: 0 0 20px 0;
border-bottom: 20px solid #000000;
}
#sidebar h1 { border-bottom: 20px solid black; margin-bottom: 20px; }
If you want it for all h1
h1 { border-bottom: 20px solid black; margin-bottom: 20px; }
Try this CSS:
div > h1 { border-bottom: 20px solid black; margin-bottom: 20px; }