I'm currently adding all media queries to a site and I'm stuck with some of the header elements that refuse to float properly when I resize below 480px to mobile-wide. I want my Logo to stretch across the page and all the other elements to float on top of each other. At the moment the phone/email are side by side and social media icons are stuck on the left and won't display inline across the page. I've tried all variants of display rules but they won't budge.
body {
font-family: "Merriweather Sans", sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333333;
}
body {
margin: 0 auto 0 auto;
}
.container {
margin: auto;
max-width: 100%;
padding-left: 10px;
padding-right: 10px;
}
header {
background: #ffffff;
height: 100px;
top: 0;
z-index: 10;
}
.left-header {
background: white;
width: 50%;
float: left;
height: 100px;
}
.right-header {
background: white;
width: 50%;
float: right;
height: 50px;
}
.right-header-top {
background: white;
float: right;
width: 100%;
height: 100%;
margin-right: 100px;
}
.right-header-bottom {
background: white;
float: left;
width: 100%;
height: 100%;
}
#logo {
margin-left: 60px;
margin-top: 50px;
}
nav {
float: left;
font-weight: 400;
}
nav a {
color: #000000;
text-decoration: none;
display: inline-block;
margin-top: 15px;
margin-right: 25px;
font-size: 12px;
}
div#contact {
float: right;
margin-right: 20px;
}
div#contact img {
display: inline-block;
border: 10px;
margin: 20px;
width: 30px;
height: 30px;
}
div#contact p {
display: inline-block;
margin-top: 25px;
font-size: 10px;
}
.right-header-bottom i {
height: 10px;
width: 10px;
border: 15px;
float: left;
margin-top: 15px;
margin-right: 10px;
margin-left: 10px;
}
a {
color: #000000;
text-decoration: none;
}
a:hover {
color: #000000;
}
#media screen and (max-width: 1000px) {
div.container {
float: none;
margin: 0 20px 0 20px;
}
div.column {
float: none;
}
}
#media screen and (max-width: 480px) {
header {
float: none;
height: auto;
}
nav {
float: none;
text-align: center;
padding-bottom: 10px;
padding-top: 10px;
}
nav a {
display: block;
}
.right-header {
height: auto;
width: auto;
}
.right-header-top {
float: none;
}
.right-header-bottom {
float: none;
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<header>
<div class="left-header">
<img src="http://localhost:8888/wp-content/uploads/2017/07/Logo.png" alt="logo" id="logo" style="width:250px;height:30px;">
</div>
<div class="right-header">
<div class="right-header-top">
<div id="contact">
<img src="http://localhost:8888/wp-content/uploads/2017/07/phone.png">
<p>0113 220 5265</p>
<img src="http://localhost:8888/wp-content/uploads/2017/07/email.png">
<p>hello#featuremedia.co.uk</p>
</div>
</div>
<div class="right-header-bottom">
<nav>
HOME
PORTFOLIO
PRODUCTS
ABOUT
CONTACT
BLOG
</nav>
<i class="fa fa-facebook" aria-hidden="true"></i>
<i class="fa fa-twitter" aria-hidden="true"></i>
<i class="fa fa-instagram" aria-hidden="true"></i>
<i class="fa fa-youtube-play" aria-hidden="true"></i>
<i class="fa fa-linkedin" aria-hidden="true"></i>
</div>
</div>
</header>
Here's how it looks -
You've got a lot of floats to kill.
A few things to display block and some text to align enter.
body {
font-family: "Merriweather Sans", sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333333;
}
body {
margin: 0 auto 0 auto;
}
.container {
margin: auto;
max-width: 100%;
padding-left: 10px;
padding-right: 10px;
}
header {
background: #ffffff;
height: 100px;
top: 0;
z-index: 10;
}
.left-header { background:white; width:50%; float:left; height: 100px; }
.right-header { background:white; width:50%; float:right; height: 50px; }
.right-header-top { background: white; float: right; width: 100%; height: 100%; margin-right: 100px; }
.right-header-bottom { background: white; float: left; width: 100%; height: 100%; }
#logo {
margin-left: 60px;
margin-top: 50px;
}
nav {
float: left;
font-weight: 400;
}
nav a {
color: #000000;
text-decoration: none;
display: inline-block;
margin-top: 15px;
margin-right: 25px;
font-size: 12px;
}
div#contact {
float: right;
margin-right: 20px;
}
div#contact img {
display: inline-block;
border: 10px;
margin: 20px;
width: 30px;
height: 30px;
}
div#contact p {
display: inline-block;
margin-top: 25px;
font-size: 10px;
}
.right-header-bottom i {
height: 10px;
width: 10px;
border: 15px;
float: left;
margin-top: 15px;
margin-right: 10px;
margin-left: 10px;
}
a {
color: #000000;
text-decoration: none;
}
a:hover {
color: #000000;
}
#media screen and (max-width: 1000px) {
div.container {
float: none;
margin: 0 20px 0 20px;
}
div.column {
float: none;
}
}
#media screen and (max-width: 480px) {
header {
float: none;
height: auto;
}
nav {
float: none;
text-align: center;
padding-bottom: 10px;
padding-top: 10px;
}
nav a {
display: block;
}
.right-header {
height: auto;
width: auto;
}
.right-header-top {
float: none;
}
.right-header-bottom {
float: none;
}
}
/* Added Styles */
.left-header {
display: block;
float: none;
width: 100%;
height: auto;
}
img#logo {
min-width: 100%;
margin: auto;
height: auto !important;
}
.right-header {
display: block;
float: none;
width: 100%;
height: auto;
}
div[class*="header"] {
display: block;
float: none;
width: 100%;
height: auto;
text-align: center;
}
div#contact {
float: none;
display: block;
width: 100%;
margin: auto;
text-align: center;
}
header {
height: auto;
}
body {
max-width: 500px;
border: 1px dashed #ccc;
min-height: 400px;
}
nav {
float: none;
width: 100%;
text-align: center;
}
.right-header-bottom i {
float: none;
}
/* Centered Nav, Email & Phone */
h1 {
text-align: center;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ddd;
margin-bottom: 0px;
margin-top: 100px;
}
h1 {
text-align: center;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ddd;
margin-bottom: 0px;
margin-top: 100px;
}
div#contact
> div img {
margin: auto;
}
div#contact
> div p {
margin: auto 10px;
line-height: 3em;
vertical-align: top;
}
div#contact
> div:first-of-type {
margin-bottom: 10px;
}
nav.block a {
display: block;
margin: 10px auto;
}
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<header>
<div class="left-header">
<img src="https://placehold.it/500x100" alt="logo" id="logo" style="width:250px;height:30px;">
</div>
<div class="right-header">
<div class="right-header-top">
<div id="contact">
<img src="https://placehold.it/50x50">
<p>0113 220 5265</p>
<img src="https://placehold.it/50x50">
<p>hello#featuremedia.co.uk</p>
</div>
</div>
<div class="right-header-bottom">
<nav>
HOME
PORTFOLIO
PRODUCTS
ABOUT
CONTACT
BLOG
</nav>
<i class="fa fa-facebook" aria-hidden="true"></i>
<i class="fa fa-twitter" aria-hidden="true"></i>
<i class="fa fa-instagram" aria-hidden="true"></i>
<i class="fa fa-youtube-play" aria-hidden="true"></i>
<i class="fa fa-linkedin" aria-hidden="true"></i>
</div>
</div>
</header>
</body>
<h1>Center Nav, Email & Phone</h1>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<header>
<div class="left-header">
<img src="https://placehold.it/500x100" alt="logo" id="logo">
</div>
<div class="right-header">
<div class="right-header-top">
<div id="contact">
<div>
<img src="https://placehold.it/50x50">
<p>0113 220 5265</p>
</div>
<div>
<img src="https://placehold.it/50x50">
<p>hello#featuremedia.co.uk</p>
</div>
</div>
</div>
<div class="right-header-bottom">
<nav class="block">
HOME
PORTFOLIO
PRODUCTS
ABOUT
CONTACT
BLOG
</nav>
<i class="fa fa-facebook" aria-hidden="true"></i>
<i class="fa fa-twitter" aria-hidden="true"></i>
<i class="fa fa-instagram" aria-hidden="true"></i>
<i class="fa fa-youtube-play" aria-hidden="true"></i>
<i class="fa fa-linkedin" aria-hidden="true"></i>
</div>
</div>
</header>
</body>
get rid of float: right on div#contact and change display: inline-block to display: block on nav a
-OR-
Use this CSS for your nav:
nav {
display: flex;
flex-direction: column;
}
nav a {
align-self: center;
}
And you still have to kill the float on the header.
Here is a useful fiddle I keep in my bookmarks for flexbox reference. It shows everything flexbox can do and makes it relatively easy to understand:
https://codepen.io/enxaneta/full/adLPwv
Related
I am trying to use a checkbox to make my font awesome icon trigger the menu icon to open and close the menu (which is how I want it to be design wise) when the screen is in mobile view.
Thanks in advance for any help.
/*** General ***/
* {
font-family: 'Noto Serif SC', serif;
margin: 0;
padding: 0;
}
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 400px;
height: auto;
}
.contents1 {
margin-top: 5vh;
margin-bottom: 10vh;
}
a {
text-decoration: none;
color: black;
margin: none;
padding: none;
}
/*** Header ***/
.header {
margin-top: 20px;
margin-bottom: 20px;
}
.logo {
text-align: center;
font-size: 30px;
}
/*** Navigation ***/
.fa-bars {
display: none;
}
.nav-links {
width: 100%;
float: left;
position: sticky;
align-items: center;
justify-content: center;
padding: 0;
background-color: #f7f7f7;
border-bottom: 1px solid rgb(228, 224, 224);
display: flex;
}
.nav-links li {
list-style: none;
text-align: center;
font-size: 18px;
float: left;
padding: 14px 16px;
}
.nav-links li a {
text-decoration: none;
text-align: center;
float: left;
}
/*** Footer ***/
.footer {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
text-align: center;
}
.footer2 {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
text-align: center;
}
/*** Media Queries ***/
#media only screen and (max-width: 800px) {
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 375px;
height: auto;
}
}
#media only screen and (max-width: 700px) {
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 350px;
height: auto;
}
}
#media only screen and (max-width: 600px) {
.fa-bars {
font-size: 20px;
display: block;
float: right;
margin-top: 10px;
margin-right: 40px;
cursor: pointer;
}
.logo {
text-align: left;
font-size: 25px;
}
.nav-toggle {
display: none;
}
.nav-links,
ul {
position: fixed;
width: 100%;
height: 100vh;
text-align: center;
background-color: #f7f7f7;
border-bottom: 1px solid rgb(107, 76, 76);
top: 80px;
left: 0;
flex-direction: column;
display: none;
}
.nav-toggle:checked+.nav-links,
ul {
display: flex;
}
.nav-links li {
display: block;
}
.contents1 {
margin-top: 5vh;
}
}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght#200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<div class="header">
<div>
<div class="logo">
<h4>The Blue Lion <i class="fas fa-bars" id="nav-toggle"></i></h4>
<input type="checkbox" id="nav-toggle" class="nav-toggle">
</div>
</div>
<label for="nav-toggle" class="nav-toggle-label">
<span></span>
</label>
</div>
<div class="navbar">
<div class="nav-links" id="myTopnav">
<ul>
<li a href="#">Food</li>
<li a href="#">Drink</li>
<li a href="#">Covid-19</li>
<li a href="#">News</li>
<li a href="#">Join the Team</li>
</ul>
</div>
</div>
<div class="contents1">
<img src="https://mcdn.wallpapersafari.com/medium/84/3/pQuUz4.jpg" class="bluepic" alt="Blue">
</div>
<div class="footer">
<div class="info">
Leave us a review:
<i class="fab fa-tripadvisor"></i>
</div>
<div class="socialiconsf">
<i class="fab fa-facebook-f"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-instagram"></i>
</div>
</div>
<div class="footer2">
<p>
© The Blue Lion 2021
</p>
</div>
Do this:
* {
font-family: 'Noto Serif SC', serif;
margin: 0;
padding: 0;
}
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 400px;
height: auto;
}
.contents1 {
margin-top: 5vh;
margin-bottom: 10vh;
}
a {
text-decoration: none;
color: black;
margin: none;
padding: none;
}
/*** Header ***/
.header {
margin-top: 20px;
margin-bottom: 20px;
}
.logo {
text-align: center;
font-size: 30px;
}
/*** Navigation ***/
.fa-bars {
display: none;
}
.nav-links {
width: 100%;
float: left;
position: sticky;
align-items: center;
justify-content: center;
padding: 0;
background-color: #f7f7f7;
border-bottom: 1px solid rgb(228, 224, 224);
display: flex;
}
.nav-links li {
list-style: none;
text-align: center;
font-size: 18px;
float: left;
padding: 14px 16px;
}
.nav-links li a {
text-decoration: none;
text-align: center;
float: left;
}
/*** Footer ***/
.footer {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
text-align: center;
}
.footer2 {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
text-align: center;
}
/*** Media Queries ***/
#media only screen and (max-width: 800px) {
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 375px;
height: auto;
}
}
#media only screen and (max-width: 700px) {
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 350px;
height: auto;
}
}
#media only screen and (max-width: 600px) {
.fa-bars {
font-size: 20px;
display: block;
float: right;
margin-top: 10px;
margin-right: 40px;
cursor: pointer;
}
.logo {
text-align: left;
font-size: 25px;
}
.nav-toggle {
display: none;
}
.nav-links,
ul {
width: 100%;
height: 100vh;
text-align: center;
background-color: #f7f7f7;
border-bottom: 1px solid rgb(107, 76, 76);
top: 80px;
left: 0;
flex-direction: column;
display: none;
}
.nav-toggle:checked+.nav-links,
ul {
display: flex;
}
.nav-links li {
display: block;
}
.contents1 {
margin-top: 5vh;
}
}
#media (max-width:600px){
.hamburger-menu{
position: relative;
}
.checkbox:checked~ .nav-links{
display: block;
}
}
<div class="header">
<div>
<div class="logo">
<h4>The Blue Lion
</div>
</h4>
</div>
<label for="nav-toggle" class="nav-toggle-label">
<span></span>
</label>
</div>
</div>
<div class="navbar">
<input type="checkbox" id="check" class="checkbox" hidden>
<label for="check" class="fas fa-bars"></label>
<div class="nav-links" id="myTopnav">
<ul>
<li a href="#">Food</li>
<li a href="#">Drink</li>
<li a href="#">Covid-19</li>
<li a href="#">News</li>
<li a href="#">Join the Team</li>
</ul>
</div>
</div>
<div class="contents1">
<img src="bluepic1.jpg" class="bluepic" alt="Blue">
</div>
<div class="footer">
<div class="info">
Leave us a review:
<i class="fab fa-tripadvisor"></i>
</div>
<div class="socialiconsf">
<i class="fab fa-facebook-f"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-instagram"></i>
</div>
</div>
<div class="footer2">
<p>
© The Blue Lion 2021
</p>
</div>
CSS modification:
The font-awesome library overrides your CSS. That is why your menu-icon (.fa-bars) wouldn't hide when not in mobile mode.
I made following corrections to your CSS:
Changing .fa-bars to .fas.fa-bars
Adding !important in mobile mode
(to show always when media break-point (... and (max-width: 600px))
/*** Navigation ***/
.fas.fa-bars {
display: none;
}
#media only screen and (max-width: 600px) {
.fas.fa-bars {
font-size: 20px;
display: block !important;
float: right;
margin-top: 10px;
margin-right: 40px;
cursor: pointer;
}
}
Click event handler on checkBox:
Also, if you want functionality to your checkbox, then you would have to add an event-handler in JS and add the onClick=function() in your HTML (and correct the issue of the multiple assigned id as mentioned in comments: I replaced id="nav-toggle" with id="nav-toggle-bars" for the <i class="fas fa-bars" element).
Following complete code for you to Run code snippet and comment if this is your desired outcome (please advise).
Expand to "full-page" and change your browser width to see effect
below media break-point (... and (max-width: 600px))
const menuToggle = document.getElementById("nav-toggle-bars");
let menuCheckBox;
function showHideNavToggle(event) {
menuCheckBox = event.target;
if (menuCheckBox.checked) {
menuToggle.style.display = "block";
} else {
menuToggle.style.display = "none";
}
}
/*** General ***/
* {
font-family: 'Noto Serif SC', serif;
margin: 0;
padding: 0;
}
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 400px;
height: auto;
}
.contents1 {
margin-top: 5vh;
margin-bottom: 10vh;
}
a {
text-decoration: none;
color: black;
margin: none;
padding: none;
}
/*** Header ***/
.header {
margin-top: 20px;
margin-bottom: 20px;
}
.logo {
text-align: center;
font-size: 30px;
}
/*** Navigation ***/
.fas.fa-bars {
display: none;
}
.nav-links {
width: 100%;
float: left;
position: sticky;
align-items: center;
justify-content: center;
padding: 0;
background-color: #f7f7f7;
border-bottom: 1px solid rgb(228, 224, 224);
display: flex;
}
.nav-links li {
list-style: none;
text-align: center;
font-size: 18px;
float: left;
padding: 14px 16px;
}
.nav-links li a {
text-decoration: none;
text-align: center;
float: left;
}
/*** Footer ***/
.footer {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
text-align: center;
}
.footer2 {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
text-align: center;
}
/*** Media Queries ***/
#media only screen and (max-width: 800px) {
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 375px;
height: auto;
}
}
#media only screen and (max-width: 700px) {
.bluepic {
padding-top: 10px;
display: block;
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 350px;
height: auto;
}
}
#media only screen and (max-width: 600px) {
.fas.fa-bars {
font-size: 20px;
display: block !important;
float: right;
margin-top: 10px;
margin-right: 40px;
cursor: pointer;
}
.logo {
text-align: left;
font-size: 25px;
}
.nav-toggle {
display: none;
}
.nav-links,
ul {
position: fixed;
width: 100%;
height: 100vh;
text-align: center;
background-color: #f7f7f7;
border-bottom: 1px solid rgb(107, 76, 76);
top: 80px;
left: 0;
flex-direction: column;
display: none;
}
.nav-toggle:checked+.nav-links,
ul {
display: flex;
}
.nav-links li {
display: block;
}
.contents1 {
margin-top: 5vh;
}
}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght#200&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<div class="header">
<div>
<div class="logo">
<h4>The Blue Lion <i class="fas fa-bars" id="nav-toggle-bars"></i></h4>
<input type="checkbox" onclick="showHideNavToggle(event)" id="nav-toggle" class="nav-toggle">
</div>
</div>
<label for="nav-toggle" class="nav-toggle-label">
<span></span>
</label>
</div>
<div class="navbar">
<div class="nav-links" id="myTopnav">
<ul>
<li a href="#">Food</li>
<li a href="#">Drink</li>
<li a href="#">Covid-19</li>
<li a href="#">News</li>
<li a href="#">Join the Team</li>
</ul>
</div>
</div>
<div class="contents1">
<img src="https://mcdn.wallpapersafari.com/medium/84/3/pQuUz4.jpg" class="bluepic" alt="Blue">
</div>
<div class="footer">
<div class="info">
Leave us a review:
<i class="fab fa-tripadvisor"></i>
</div>
<div class="socialiconsf">
<i class="fab fa-facebook-f"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-instagram"></i>
</div>
</div>
<div class="footer2">
<p>
© The Blue Lion 2021
</p>
</div>
Note:
I also corrected 2 html closing tags (one </div> eliminated and </h4> closing tag corrected and replaced img source with a link to a generic blue background)
See this response in codepen.
https://codepen.io/threefingers/pen/PojZMpx
Add in your ::before element icon, the code icons in your states.
.mydiv{
background-color: blue;
height: 50px;
width: 50px;
}
input + .mydiv::before{
content: 'code icon 1';
}
input:checked + .mydiv::before{
content: 'code icon 2';
}
<input type="checkbox" value="Car"> I have a car
<div class="mydiv"></div>
I am pretty new to coding and I am doing this for my online college class. For some reason, my footer is not going to the bottom. Neglect the navigation bar above.
I also need more words to post this so I'm going to keep adding word until it says I am fine. So yeah I keep talking and talking and talking well actually I'm typing and not talking so I'm typing typing typing until this post says I have enough words because this code is pretty big.
Here is my code:
body {
background-color: #e1b382;
color: #e1b382;
font-family: Verdana, Arial, sans-serif;
}
header {
background-color: #2d545e;
background-image: url(lilyheader.jpg);
background-position: right;
background-repeat: no-repeat;
height: 150px;
display: block;
text-align: center;
}
h1 {
padding-top: 50px;
}
nav {
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
width: 100%;
overflow: auto;
}
main nav {
display: inline-block;
float: left;
width: 198px;
float: left;
margin-left: 75px;
border: 1px solid #2d545e;
}
main nav a {
float: left;
text-decoration: none;
margin: -20px;
}
nav a {
text-decoration: none;
text-align: center;
padding: 2%;
padding: 2%;
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
nav a:hover {
color: #e1b382;
background-color: #2d545e;
}
.search {
text-decoration: none;
text-align: center;
font-weight: bold;
;
padding-left: calc(2%);
padding-right: calc(18%);
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
.search:hover {
color: #e1b382;
background-color: #2d545e;
}
footer {
background-color: #2d545e;
font-size: .60em;
text-align: center;
font-style: italic;
padding: 1em;
display: block;
bottom: 0;
}
#wrapper {
width: 80%;
margin-right: auto;
margin-left: auto;
background-color: white;
min-height: 1000px;
min-width: 900px;
max-width: 1200px;
}
main {
display: block;
color: #2d545e;
padding-top: 10px;
}
.floatright {
float: right;
margin-left: 400px;
}
ul {
list-style-type: none;
}
main li {
display: inline-block;
width: 200px;
padding-bottom: 10px;
margin: 10px;
text-align: center;
font-family: Arial, Georgia;
}
.column {
float: left;
width: 50%;
padding-bottom: 3px;
}
.row::after {
content: "";
clear: both;
display: table;
}
h2 {
padding-left: 2em;
}
.borderdiv {
float: left;
width: calc(50% - 2px);
padding-bottom: 3px;
border: 1px solid #e1b382;
}
main div div div img {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border: 1px outset #e1b382
}
main div div div img:hover {
border: 1px inset #2d545e
}
main a {
color: #2d545e;
}
section {
display: block;
margin-left: 300px;
}
.bar {
display: inline-block;
margin-top: -29px;
height: 30px;
padding-left: 10px;
padding-right: 300px;
border: 1px solid gray;
}
.pic {
width: 30%;
float: left;
}
.item {
width: 70%;
float: right;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ONSHOP Online Store and Shipping :: Items</title>
<link rel="stylesheet" href="research.css">
<!--Reed Wilson-->
</head>
<body>
<div id="wrapper">
<header>
<h1>ONSHOP</h1>
</header>
<nav>
Home
Items
<a>Ordered</a>
<a>Sale</a>
<a>Saved</a>
<a>Login</a>
<a>Watchlist</a>
<a>Help</a>
<a class="search">Search</a>
</nav>
<main>
<h2 style="margin-left:25px">Items</h2>
<nav>
<ul>
<li><a>Clothes</a></li>
<li><a>Food</a></li>
<li><a>Home</a></li>
<li><a>Toys</a></li>
<li><a>Sports</a></li>
<li><a>Animal Care</a></li>
<li><a>Electronics</a></li>
<li><a>Kitchen</a></li>
<li><a>Office</a></li>
<li><a>Music</a></li>
<li><a>Toiletries</a></li>
<li><a>Filter</a></li>
</ul>
</nav>
<section>
<div>
<p class="bar">Search</p>
</div>
<div class="borderdiv">
<div class="row">
<div class="pic">
<img src="shopping-6.jpg" alt="Home">
</div>
<div class="item">
<h6>Lysol Hand Sanitizer 4 Pack</h6>
</div>
</div>
<div class="row">
<div class="pic">
<img src="shopping-3.jpg" alt="Home">
</div>
<div class="item">
<h6>Clorox Disinfecting Wipes</h6>
</div>
</div>
</div>
</section>
</main>
<footer>
<p>Copyright © 2020 Design of a Major Website<br>
reed#wilson.com</p>
</footer>
</div>
</body>
</html>
What you should do is to provide height to the main class, provide how much height you need.
main{
height:800px; //just an example height.
}
Please find the code:
body {
background-color: #e1b382;
color: #e1b382;
font-family: Verdana, Arial, sans-serif;
}
header {
background-color: #2d545e;
background-image: url(lilyheader.jpg);
background-position: right;
background-repeat: no-repeat;
height: 150px;
display: block;
text-align: center;
}
h1 {
padding-top: 50px;
}
nav {
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
width: 100%;
overflow: auto;
}
main{
height:800px;
}
main nav {
display: inline-block;
float: left;
width: 198px;
float: left;
margin-left: 75px;
border: 1px solid #2d545e;
}
main nav a {
float: left;
text-decoration: none;
margin: -20px;
}
nav a {
text-decoration: none;
text-align: center;
padding: 2%;
padding: 2%;
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
nav a:hover {
color: #e1b382;
background-color: #2d545e;
}
.search {
text-decoration: none;
text-align: center;
font-weight: bold;
;
padding-left: calc(2%);
padding-right: calc(18%);
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
.search:hover {
color: #e1b382;
background-color: #2d545e;
}
footer {
background-color: #2d545e;
font-size: .60em;
text-align: center;
font-style: italic;
padding: 1em;
display: block;
bottom: 0;
}
#wrapper {
width: 80%;
margin-right: auto;
margin-left: auto;
background-color: white;
min-height: 1000px;
min-width: 900px;
max-width: 1200px;
}
main {
display: block;
color: #2d545e;
padding-top: 10px;
}
.floatright {
float: right;
margin-left: 400px;
}
ul {
list-style-type: none;
}
main li {
display: inline-block;
width: 200px;
padding-bottom: 10px;
margin: 10px;
text-align: center;
font-family: Arial, Georgia;
}
.column {
float: left;
width: 50%;
padding-bottom: 3px;
}
.row::after {
content: "";
clear: both;
display: table;
}
h2 {
padding-left: 2em;
}
.borderdiv {
float: left;
width: calc(50% - 2px);
padding-bottom: 3px;
border: 1px solid #e1b382;
}
main div div div img {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border: 1px outset #e1b382
}
main div div div img:hover {
border: 1px inset #2d545e
}
main a {
color: #2d545e;
}
section {
display: block;
margin-left: 300px;
}
.bar {
display: inline-block;
margin-top: -29px;
height: 30px;
padding-left: 10px;
padding-right: 300px;
border: 1px solid gray;
}
.pic {
width: 30%;
float: left;
}
.item {
width: 70%;
float: right;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ONSHOP Online Store and Shipping :: Items</title>
<link rel="stylesheet" href="research.css">
<!--Reed Wilson-->
</head>
<body>
<div id="wrapper">
<header>
<h1>ONSHOP</h1>
</header>
<nav>
Home
Items
<a>Ordered</a>
<a>Sale</a>
<a>Saved</a>
<a>Login</a>
<a>Watchlist</a>
<a>Help</a>
<a class="search">Search</a>
</nav>
<main>
<h2 style="margin-left:25px">Items</h2>
<nav>
<ul>
<li><a>Clothes</a></li>
<li><a>Food</a></li>
<li><a>Home</a></li>
<li><a>Toys</a></li>
<li><a>Sports</a></li>
<li><a>Animal Care</a></li>
<li><a>Electronics</a></li>
<li><a>Kitchen</a></li>
<li><a>Office</a></li>
<li><a>Music</a></li>
<li><a>Toiletries</a></li>
<li><a>Filter</a></li>
</ul>
</nav>
<section>
<div>
<p class="bar">Search</p>
</div>
<div class="borderdiv">
<div class="row">
<div class="pic">
<img src="shopping-6.jpg" alt="Home">
</div>
<div class="item">
<h6>Lysol Hand Sanitizer 4 Pack</h6>
</div>
</div>
<div class="row">
<div class="pic">
<img src="shopping-3.jpg" alt="Home">
</div>
<div class="item">
<h6>Clorox Disinfecting Wipes</h6>
</div>
</div>
</div>
</section>
</main>
<footer>
<p>Copyright © 2020 Design of a Major Website<br>
reed#wilson.com</p>
</footer>
</div>
</body>
You are using float:left in for left nav. That's why the height of that container is not being calculated and your footer showing in the middle.
Remove float:left, use display: inline-block for left nav and section with vertical-align:top. Avoid using fixed height in not necessary.
Below is the corrected code snippet.
body {
background-color: #e1b382;
color: #e1b382;
font-family: Verdana, Arial, sans-serif;
}
header {
background-color: #2d545e;
background-image: url(lilyheader.jpg);
background-position: right;
background-repeat: no-repeat;
height: 150px;
display: block;
text-align: center;
}
h1 {
padding-top: 50px;
}
nav {
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
width: 100%;
overflow: auto;
}
main nav {
display: inline-block;
vertical-align:top;
width: 198px;
margin-left: 75px;
border: 1px solid #2d545e;
}
main nav a {
float: left;
text-decoration: none;
margin: -20px;
}
nav a {
text-decoration: none;
text-align: center;
padding: 2%;
padding: 2%;
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
nav a:hover {
color: #e1b382;
background-color: #2d545e;
}
.search {
text-decoration: none;
text-align: center;
font-weight: bold;
;
padding-left: calc(2%);
padding-right: calc(18%);
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
.search:hover {
color: #e1b382;
background-color: #2d545e;
}
footer {
background-color: #2d545e;
font-size: .60em;
text-align: center;
font-style: italic;
padding: 1em;
display: block;
bottom: 0;
}
#wrapper {
width: 80%;
margin-right: auto;
margin-left: auto;
background-color: white;
min-height: 1000px;
min-width: 900px;
max-width: 1200px;
}
main {
display: block;
color: #2d545e;
padding-top: 10px;
}
.floatright {
float: right;
margin-left: 400px;
}
ul {
list-style-type: none;
}
main li {
display: inline-block;
width: 200px;
padding-bottom: 10px;
margin: 10px;
text-align: center;
font-family: Arial, Georgia;
}
.column {
float: left;
width: 50%;
padding-bottom: 3px;
}
.row::after {
content: "";
clear: both;
display: table;
}
h2 {
padding-left: 2em;
}
.borderdiv {
float: left;
width: calc(50% - 2px);
padding-bottom: 3px;
border: 1px solid #e1b382;
}
main div div div img {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border: 1px outset #e1b382
}
main div div div img:hover {
border: 1px inset #2d545e
}
main a {
color: #2d545e;
}
section {
display: inline-block;
vertical-align:top;
}
.bar {
display: inline-block;
margin-top: -29px;
height: 30px;
padding-left: 10px;
padding-right: 300px;
border: 1px solid gray;
}
.pic {
width: 30%;
float: left;
}
.item {
width: 70%;
float: right;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ONSHOP Online Store and Shipping :: Items</title>
<link rel="stylesheet" href="research.css">
<!--Reed Wilson-->
</head>
<body>
<div id="wrapper">
<header>
<h1>ONSHOP</h1>
</header>
<nav>
Home
Items
<a>Ordered</a>
<a>Sale</a>
<a>Saved</a>
<a>Login</a>
<a>Watchlist</a>
<a>Help</a>
<a class="search">Search</a>
</nav>
<main>
<h2 style="margin-left:25px">Items</h2>
<nav>
<ul>
<li><a>Clothes</a></li>
<li><a>Food</a></li>
<li><a>Home</a></li>
<li><a>Toys</a></li>
<li><a>Sports</a></li>
<li><a>Animal Care</a></li>
<li><a>Electronics</a></li>
<li><a>Kitchen</a></li>
<li><a>Office</a></li>
<li><a>Music</a></li>
<li><a>Toiletries</a></li>
<li><a>Filter</a></li>
</ul>
</nav>
<section>
<div>
<p class="bar">Search</p>
</div>
<div class="borderdiv">
<div class="row">
<div class="pic">
<img src="shopping-6.jpg" alt="Home">
</div>
<div class="item">
<h6>Lysol Hand Sanitizer 4 Pack</h6>
</div>
</div>
<div class="row">
<div class="pic">
<img src="shopping-3.jpg" alt="Home">
</div>
<div class="item">
<h6>Clorox Disinfecting Wipes</h6>
</div>
</div>
</div>
</section>
</main>
<footer>
<p>Copyright © 2020 Design of a Major Website<br>
reed#wilson.com</p>
</footer>
</div>
</body>
</html>
I have made an edit to your code and it works. the problem was tha you have used float for your elements and you did not make a "clearfix" element for them.
body {
background-color: #e1b382;
color: #e1b382;
font-family: Verdana, Arial, sans-serif;
}
header {
background-color: #2d545e;
background-image: url(lilyheader.jpg);
background-position: right;
background-repeat: no-repeat;
height: 150px;
display: block;
text-align: center;
}
h1 {
padding-top: 50px;
}
nav {
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
width: 100%;
overflow: auto;
}
main nav {
display: inline-block;
width: 198px;
float: left;
margin-left: 75px;
border: 1px solid #2d545e;
}
main nav a {
float: left;
text-decoration: none;
margin: -20px;
}
nav a {
text-decoration: none;
text-align: center;
padding: 2%;
padding: 2%;
font-weight: bold;
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
nav a:hover {
color: #e1b382;
background-color: #2d545e;
}
.search {
text-decoration: none;
text-align: center;
font-weight: bold;
padding-left: calc(2%);
padding-right: calc(18%);
padding-top: 5px;
padding-bottom: 5px;
color: #2d545e;
}
.search:hover {
color: #e1b382;
background-color: #2d545e;
}
footer {
background-color: #2d545e;
font-size: .60em;
text-align: center;
font-style: italic;
padding: 1em;
display: block;
bottom: 0;
margin-top: 20px;
}
#wrapper {
width: 80%;
margin-right: auto;
margin-left: auto;
background-color: white;
min-height: 1000px;
min-width: 900px;
max-width: 1200px;
}
main {
display: block;
color: #2d545e;
padding-top: 10px;
}
.floatright {
float: right;
margin-left: 400px;
}
ul {
list-style-type: none;
}
main li {
display: inline-block;
width: 200px;
padding-bottom: 10px;
margin: 10px;
text-align: center;
font-family: Arial, Georgia;
}
.column {
float: left;
width: 50%;
padding-bottom: 3px;
}
.row::after {
content: "";
clear: both;
display: table;
}
h2 {
padding-left: 2em;
}
.borderdiv {
float: left;
width: calc(50% - 2px);
padding-bottom: 3px;
border: 1px solid #e1b382;
}
main div div div img {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
border: 1px outset #e1b382
}
main div div div img:hover {
border: 1px inset #2d545e
}
main a {
color: #2d545e;
}
section {
display: block;
margin-left: 300px;
}
.bar {
display: inline-block;
margin-top: -29px;
height: 30px;
padding-left: 10px;
padding-right: 300px;
border: 1px solid gray;
}
.pic {
width: 30%;
float: left;
}
.item {
width: 70%;
float: right;
}
.clearfix {
clear: both;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ONSHOP Online Store and Shipping :: Items</title>
<link rel="stylesheet" href="research.css">
<!--Reed Wilson-->
</head>
<body>
<div id="wrapper">
<header>
<h1>ONSHOP</h1>
</header>
<nav>
Home
Items
<a>Ordered</a>
<a>Sale</a>
<a>Saved</a>
<a>Login</a>
<a>Watchlist</a>
<a>Help</a>
<a class="search">Search</a>
</nav>
<main>
<h2 style="margin-left:25px">Items</h2>
<nav>
<ul>
<li><a>Clothes</a></li>
<li><a>Food</a></li>
<li><a>Home</a></li>
<li><a>Toys</a></li>
<li><a>Sports</a></li>
<li><a>Animal Care</a></li>
<li><a>Electronics</a></li>
<li><a>Kitchen</a></li>
<li><a>Office</a></li>
<li><a>Music</a></li>
<li><a>Toiletries</a></li>
<li><a>Filter</a></li>
</ul>
</nav>
<section>
<div>
<p class="bar">Search</p>
</div>
<div class="borderdiv">
<div class="row">
<div class="pic">
<img src="shopping-6.jpg" alt="Home">
</div>
<div class="item">
<h6>Lysol Hand Sanitizer 4 Pack</h6>
</div>
</div>
<div class="row">
<div class="pic">
<img src="shopping-3.jpg" alt="Home">
</div>
<div class="item">
<h6>Clorox Disinfecting Wipes</h6>
</div>
</div>
</div>
</section>
<div class="clearfix"></div>
</main>
<footer>
<p>Copyright © 2020 Design of a Major Website<br>
reed#wilson.com</p>
</footer>
</div>
</body>
</html>
I'm creating footer for my website. I encounter problems that seem to be banal, maybe not. Inside the 'footer' element is a list of 'ul', inside them 'li' with links to social media. The Chrome browser does not display these elements, similarly to Opera and Mozilla. Where is the problem? I am running out of ideas.
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
font-family: 'Lato', 'Josefin Sans', sans-serif;
font-size: 0;
}
.navbar {
font-size: 18px;
width: 100%;
position: fixed;
background-color: rgba(0, 0, 0, 0.8);
border: 1px solid rgba(0, 0, 0, 0.2);
padding-bottom: 10px;
}
.main-nav {
list-style-type: none;
}
.nav-links,
.logo {
text-decoration: none;
color: rgba(255, 255, 255, 0.7);
vertical-align: middle;
}
.main-nav li {
text-align: center;
margin: 15px auto;
}
.logo {
display: inline-block;
font-size: 22px;
margin-top: 10px;
margin-left: 20px;
}
.navbar-toggle {
position: absolute;
top: 10px;
right: 20px;
cursor: pointer;
color: rgba(255, 255, 255, 0.8);
font-size: 24px;
}
.main-nav {
list-style-type: none;
display: none;
}
.active {
display: block;
}
.background-image img {
height: 100%;
width: 100%;
}
.container {
display: flex;
height: 250px;
}
.column-left {
width: 33.333%;
background: #f2f2f2;
border: 1px solid #e6e6e6;
}
.column-center {
width: 33.333%;
background: #f2f2f2;
border: 1px solid #e6e6e6;
}
.column-right {
width: 33.333%;
background: #f2f2f2;
border: 1px solid #e6e6e6;
}
.container .column-left {
text-align: center;
padding-top: 20px;
font-size: 20px;
}
h2 {
font-size: 23px;
padding: 15px;
}
p {
font-size: 20px;
padding: 15px;
}
.container .column-center {
text-align: center;
padding-top: 20px;
font-size: 20px;
}
.container .column-right {
text-align: center;
padding-top: 20px;
font-size: 20px;
}
#media screen and (min-width: 600px) {
.navbar {
display: flex;
justify-content: space-between;
padding-bottom: 0;
height: 70px;
align-items: center;
}
.main-nav {
display: flex;
margin-right: 30px;
flex-direction: row;
justify-content: flex-end;
}
.main-nav li {
margin: 0;
}
.nav-links {
margin-left: 40px;
}
.logo {
margin-top: 0;
}
.navbar-toggle {
display: none;
}
.logo:hover,
.nav-links:hover {
color: rgba(255, 255, 255, 1);
}
}
#media screen and (max-width: 599px) {
h2.title {
font-size: 15px;
}
p {
font-size: 13px;
}
}
<link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/8a84b6b9df.js"></script>
<div>
<nav class="navbar">
<span class="navbar-toggle" id="js-navbar-toggle">
<i class="fas fa-bars"></i>
</span>
<img src="img/developer.png" alt="Sebastian Falba" width="50">
<ul class="main-nav" id="js-menu">
<li>
Home
</li>
<li>
About me
</li>
<li>
Projects
</li>
<li>
Contact
</li>
</ul>
</nav>
</div>
<div class="background-image">
<img src="img/responsive.jpg" alt="web development">
</div>
<div class="container">
<div class="column-left"><i class="fas fa-keyboard fa-3x"></i>
<h2 class="title">Modern design</h2>
<p class="description">Fantastic Clean Website Designs</p>
</div>
<div class="column-center"><i class="far fa-window-maximize fa-3x"></i>
<h2 class="title">Responsive</h2>
<p class="description">Make your website mobile-friendly</p>
</div>
<div class="column-right"><i class="fas fa-laptop-code fa-3x"></i>
<h2 class="title">Quality code</h2>
<p class="description">Coding best practices are a set of my rules</p>
</div>
</div>
<footer>
<ul>
<li>Footer</li>
</ul>
</footer>
You set the font-size to 0 so the text has no height.
Since the text has no height, the <a> has no height, so the <li> has no height, so the <ul> has no height, to the <footer> has no height, so you can't see it.
I've read other questions before and the best answer I saw was to wrap it in an anchor tag. like
<i class="fa fa-user" style="font-size:36px"></i>
but that doesn't work. My fa object turns blue so it works as a anchor object but I can't click it.
I can't find out why it isn't working. I thought maybe something with my html?
Here is my code:
<html>
<head>
<title>'.$title.'</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<link href="core/assets/css/main.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<header id="header">
<div class="container">
<h1><i class="fa fa-cloud" style="font-size:36px"></i>DataBaas</h1>
</div>
<div class="box" onclick="alert("You clicked me !")">
<i class="fa fa-user" style="font-size:36px"></i>
</div>
</header>
<div class="content">
<div class="article">
'.$content().'
<div>
</div>
</body>
</html>
I want the fa-user to be clickable and link to a other page. I tried onclick as you see in my code to check if that was working but that also won't work.
https://jsfiddle.net/cvvcxbnh/
Add position relative to box div
that's caused by absolute positioning of container, however adding z-index solves the problem but z-index works only on positioned elements (position:absolute, position:relative, or position:fixed)
body {
margin: 0;
padding: 0;
background-color: #f6f9fc;
}
#header {
z-index: 2;
position: fixed;
width: 100%;
height: 100px;
background: #fff;
box-shadow: 0px 1px 10px #888888;
}
p {
font-family: Arial;
}
#header h1 {
font-size: 2.4rem;
color: #3c8be4;
font-family: sans-serif;
}
header .container {
margin: 0 auto;
position: absolute;
text-align: center;
width: 100%;
}
.content {
padding-top: 100px;
}
.article {
margin: 100px 15%;
position: relative;
overflow-wrap: break-word;
animation-duration: 2s;
animation-name: animation1;
animation-timing-function: ease;
}
header .box {
float: right;
position:relative;
margin-top: 33px;
margin-right: 33px;
color: #4e4e4e;
text-decoration: none;
cursor:pointer;
z-index: 2;
}
.article h1{
color: #4e4e4e;
font-family: Sans-serif;
font-size: 4rem;
line-height: 0px;
}
.article p{
font-size: 1.5rem;
color: #535353;
display: inline-block;
}
.login h1{
font-size: 2rem;
}
.login {
float: right;
box-shadow: 0px 1px 10px #888888;
width: 300px;
position: relative;
border-radius: 15px;
padding: 20px;
display: inline-block;
text-align: center;
background-color: #fff;
}
.inlogform {
margin-top: 40px;
}
.login h3,h4 {
font-family: sans-serif;
font-size: 0.8rem;
line-height: 0;
margin-bottom: 5px;
text-decoration: none;
}
.login h4{
margin-top: 30px;
color: red;
}
a {
text-decoration: none;
color: inherit;
}
input[type=text] {
width: 90%;
margin: 5px 0;
padding: 8px;
border: 1px solid gray;
border-radius: 10px;
font-size: 1rem;
margin-top: 0;
}
input[type=password] {
width: 90%;
margin: 5px 0;
padding: 8px;
border: 1px solid gray;
border-radius: 10px;
font-size: 1rem;
}
input[type=submit] {
width: 90%;
margin: 20px;
padding: 8px;
border: 0px solid gray;
border-radius: 10px;
font-size: 1rem;
background-color: 3c8be4;
color: white;
margin-bottom: 5px;
}
#media (min-width: 600px) {
#keyframes animation1 {
0% {margin:0px 15%;opacity: 0;}
100% {margin: 100px 15%; opacity: 1;}
}
}
/*Mobiele Weergave*/
#media (max-width: 599px) {
#header .container {
width: 100%;
}
#header {
height: 80px;
}
#header h1 {
font-size: 30px;
float: left;
margin-left: 5%;
}
.content {
padding-top: 80px;
}
.article{
margin: 60px 5%;
}
.register {
margin-left: 5%;
}
#header .box {
margin-top: 22px;
margin-right: 22px;
}
.login {
float:left;
}
#keyframes animation1 {
0% {margin:0px 5%;opacity: 0;}
100% {margin: 60px 5%; opacity: 1;}
}
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<header id="header">
<div class="container">
<h1><i class="fa fa-cloud" style="font-size:36px"></i>DataBaas</h1>
</div>
<div class="box" >
<i class="fa fa-user" style="font-size:36px"></i>
</div>
</header>
<div class="content">
<div class="article">
'.$content().'
<div>
</div>
Here you should add "href" value inside "a" tag. And in order to open to other page just use target="_blank" inside "a" tag.Hope it will work.
<div class="container">
<h1><i class="fa fa-cloud" style="font-size:36px"></i>DataBaas</h1>
</div>
<div class="box">
<a href="#" target="_blank"><i class="fa fa-user" style="font-size:36px;
color:black;"></i></a>
</div>
I'm trying to make the top parent div with the red outline line up with the other divs below it. I attempted some percentages with the widths but they are always off
div2 is the designated div for the section with 3 divs
html,
body {
height: 100%;
padding: 0;
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
#header {
width: 100%;
height: 100px;
background: #0C2074;
font-family: Arial, Helvetica, sans-serif;
;
color: #000000;
text-align: left;
margin-top: 10px;
font-size: 200%;
margin: 0 auto;
}
#usbanklogo {
width: 40%;
height: 100%;
text-align: left;
float: left;
margin: 0 auto;
/*margin-top: 10px;*/
padding-left: 10px;
box-sizing: border-box;
}
#dealerservicesdiv {
width: 100%;
height: 100%;
vertical-align: middle;
text-align: left;
line-height: 100px;
float: left;
font-size: 1.2em;
font-weight: bolder;
color: #FFF;
box-sizing: border-box;
}
div {
width: 100%;
height: 30%;
float: left;
color: #fff;
box-sizing: border-box;
}
#div1 {
/*position: relative;*/
/*width: 30%;
height: 10%;*/
width: 270px;
height: 60px;
text-align: left;
margin-left: 5%;
color: #ff0000;
}
#div2 {
border: 4px solid#ff0000;
/*position: relative;*/
clear: both;
/*width: 90%;*/
width: 1200px;
height: 200px;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 10px;
}
#div2 > div {
/*width:15%;
height: 100%;*/
width: 170px;
height: 175px;
text-align: center;
float: left;
margin: auto;
margin-top: 10px;
box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.2);
cursor: pointer;
margin-right: 9.165%;
margin-left: 9.165%;
padding-bottom: 5px;
/*padding-left: 5px;
padding-right: 5px;*/
border: 5px solid#DDD;
box-sizing: border-box;
}
#div3 {
position: relative;
/*width: 90%;*/
width: 1200px;
height: 200px;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 10px;
}
#div3 > div {
width: 170px;
height: 175px;
text-align: center;
float: left;
margin: auto;
box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.2);
cursor: pointer;
margin-right: 5%;
margin-left: 5%;
padding-top: 5px;
padding-right: 5px;
;
padding-bottom: 5px;
padding-left: 5px;
border: 5px solid#DDD;
box-sizing: border-box;
}
#div4 {
position: relative;
/*width: 90%;*/
width: 1200px;
height: 200px;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 10px;
}
#div4 > div {
/*width:15%;
height: 85%; */
width: 170px;
height: 175px;
text-align: center;
float: left;
margin: auto;
box-shadow: 0 0 5px -1px rgba(0, 0, 0, 0.2);
cursor: pointer;
margin-right: 5%;
margin-left: 5%;
padding-top: 5px;
padding-right: 5px;
;
padding-bottom: 5px;
padding-left: 5px;
border: 5px solid#DDD;
box-sizing: border-box;
}
/*No hover for mobile app*/
#div2 > div:hover {
background-color: #ff3333;
}
#div3 > div:hover {
background-color: #ff3333;
}
#div4 > div:hover {
background-color: #ff3333;
}
#performance {
background: #67B2E8;
}
#pricing {
background: #67B2E8;
}
#credit {
background: #67B2E8;
}
#sales {
background: #67B2E8;
}
#portfolio {
background: #67B2E8;
}
#quality {
background: #67B2E8;
}
#finance {
background: #67B2E8;
}
#admin {
background: #67B2E8;
}
#dealer {
background: #67B2E8;
}
#recent {
background: #67B2E8;
}
#support {
background: #67B2E8;
}
/*Link Behavior*/
a:link {
COLOR: #000000;
TEXT-DECORATION: none
}
a:visited {
COLOR: #000000;
TEXT-DECORATION: none
}
a:active {
COLOR: #000000;
TEXT-DECORATION: none
}
/*Padding for font awesome*/
i {
padding-top: 15px;
}
/*Footer*/
#footer {
height: 40px;
background: #DDD;
/*color: #000000;*/
font-size: 120%;
margin: 0 auto;
color: #666666;
}
#footer > div {
width: 33.33%;
height: 100%;
text-align: center;
float: left;
margin: auto;
padding-top: 5px;
padding-right: 5px;
;
padding-bottom: 5px;
padding-left: 5px;
box-sizing: border-box;
color: #666666
}
<div id="wrapper">
<header>
<div id="header">
<div id="dealerservicesdiv">
<div id="usbanklogo">
<!--<img src="image/usbankLogo2.png" alt="Best In Us">-->
</div>
<!--DEALER SERVICES-->
<!--<img src="image/banner.png" alt="Best In Us">-->
</div>
</div>
</header>
<div id="div1">
<h1>Reporting</h1>
</div>
<div id="div2">
<div id="performance">
<!--File Icon-->
<a href="#">
<i class="fa fa-bar-chart-o fa-4x" aria-hidden="true"></i>
</a>
<h2>Performance Analytics</h3>
</div>
<div id = "pricing">
<a href="#">
<i class="fa fa-dollar fa-4x" aria-hidden="true"></i>
</a>
<h2>Pricing & Profitability</h3>
</div>
<div id = "credit">
<a href="#">
<i class="fa fa-credit-card-alt fa-4x" aria-hidden="true"></i>
</a>
<h2>Credit Risk</h3>
</div>
</div>
<div id="div3">
<div id = "sales">
<!--Bank Icon-->
<i class="fa fa-book fa-3x" aria-hidden="true"></i>
<h2>Sales/Credit</h2>
</div>
<div id="portfolio">
<!--Automobile Icon-->
<i class="fa fa-automobile fa-3x" aria-hidden="true"></i>
<h2>Portfolio</h2>
</div>
<div id="quality">
<!--Balance Scale Icon-->
<i class="fa fa-balance-scale fa-3x" aria-hidden="true"></i>
<h2>Quality/Audit</h2>
</div>
<div id="finance">
<!--Money Icon-->
<i class="fa fa-money fa-3x" aria-hidden="true"></i>
<h2>Finance</h2>
</div>
</div>
<div id="div4">
<div id="admin">
<!--Support Icon-->
<a href="#">
<i class="fa fa-support fa-3x" aria-hidden="true"></i>
</a>
<h2>Admin</h2>
</div>
<div id="dealer">
<!--Commenting Icon-->
<i class="fa fa-commenting fa-3x" aria-hidden="true"></i>
<h2>Dealer Comments</h2>
</div>
<div id="recent">
<!--Thum Tack Icon-->
<i class="fa fa-thumb-tack fa-3x" aria-hidden="true"></i>
<h2>Recent Visits</h2>
</div>
<div id="support">
<i class="fa fa-phone fa-3x" aria-hidden="true"></i>
<h2>Support</h2>
</div>
</div>
<footer>
<div id="footer">
<div id="usbnet">
<a href="#">
<span>USBNet</span>
</a>
</div>
<div id="bestinus">
<a href="#">
<span>Best In Us</span>
</a>
</div>
<div>
<span>© 2016 U.S Bancorp. All Rights Reserved.</span>
</div>
</div>
</footer>
Try using outline instead of border. The arguments are the same and outline doesn't effect layout like border does. (You'll also need to reset the CSS you've been mucking around with on #div2 to match what it is on the other divs.)