Im making a portfolio website, since I need to deliver it for school.
Now I'm trying to text-align center my buttons on the webpage. I have tried a lot,
giving the li, ol and several class the : text-align: center, margin-right/margin-left:auto. Nothing seems to work. I've been stuck now for more than 1,5 hour, so it would be amazing if one of you guys could help me out with this problem.
Thanks a lot in advance!
Noah
Picture here : https://imgur.com/EAQTdVM
HTML:
<div class="jumbotron">
<div class="container container-fluid">
<div class="row">
<div class="col-md-12 midden ">
<ol>
<li>Contact</li>
<li>Work</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-3-offset-3">
<h1>Noah Wallaart</h1>
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
Css:
.jumbotron {
background: url("/image/background4.JPG") no-repeat scroll center center / cover;
height: 720px;
margin-top: -20px;
}
div h1 {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
font-size: 50px;
color: white !important;
text-align: center;
margin-top: 0.2em;
}
p {
font-family: 'Open Sans', sans-serif;
font-size: 30px;
color: white;
}
a {
text-decoration: none;
color: black;
font-family: 'Open Sans', sans-serif;
border: 3px solid black;
padding: 10px 20px 10px 20px;
display: inline;
float: left;
margin: 20px;
}
li {
display: inline;
float: right;
}
a:hover {
text-decoration: none;
background-color: #BDBFBD;
color: white;
border: 3px solid white;
}
/* Lookbook */
section {
width: 80%;
margin-left: auto;
margin-right: auto;
}
.row-margin {
margin-bottom: 20px;
margin-top: 20px;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.less-padding {
padding: 0px;
}
/* Buttons */
li a {
text-decoration: none;
color: white;
font-weight: 200 font-family: 'Roboto', sans-serif;
border: 0.15em solid white;
padding: 10px 20px 10px 20px;
display: inline;
float: left;
margin: 20px;
}
li {
display: inline;
width: 120px;
}
a:hover {
text-decoration: none;
background-color: #BDBFBD;
color: white;
border: 3px solid white;
margin-bottom: 0px;
margin-left: 20px;
}
Some of your markup was off, 'midden' is not a word, all you had to do was 'text-center' the row and it works fine. Good luck!
<div class="jumbotron">
<div class="container container-fluid">
<div class="row text-center">
<div class="col-md-12">
<ul class="list-unstyled list-inline">
<li>Contact</li>
<li>Work</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-3-offset-3">
<h1>Noah Wallaart</h1>
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
Here we go, add these styles
.midden ol {
margin-top: 0;
margin-bottom: 10px;
display: table;
margin: 0 auto;
}
.midden li{
float: none;
}
.midden ol {
margin-top: 0;
margin-bottom: 10px;
display: table;
margin: 0 auto;
}
.midden li{
float: none;
}
.jumbotron {
background: url("http://www.govisitcostarica.com/images/photos/full-hot-air-balloons-near-arenal.jpg") no-repeat scroll center center / cover;
height: 720px;
margin-top: -20px;
}
div h1 {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
font-size: 50px;
color: white !important;
text-align: center;
margin-top: 0.2em;
}
p {
font-family: 'Open Sans', sans-serif;
font-size: 30px;
color: white;
}
a {
text-decoration: none;
color: black;
font-family: 'Open Sans', sans-serif;
border: 3px solid black;
padding: 10px 20px 10px 20px;
display: inline;
float: left;
margin: 20px;
}
li {
display: inline;
float: right;
}
a:hover {
text-decoration: none;
background-color: #BDBFBD;
color: white;
border: 3px solid white;
}
/* Lookbook */
section {
width: 80%;
margin-left: auto;
margin-right: auto;
}
.row-margin {
margin-bottom: 20px;
margin-top: 20px;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.less-padding {
padding: 0px;
}
/* Buttons */
li a {
text-decoration: none;
color: white;
font-weight: 200 font-family: 'Roboto', sans-serif;
border: 0.15em solid white;
padding: 10px 20px 10px 20px;
display: inline;
float: left;
margin: 20px;
}
li {
display: inline;
width: 120px;
}
a:hover {
text-decoration: none;
background-color: #BDBFBD;
color: white;
border: 3px solid white;
margin-bottom: 0px;
margin-left: 20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="jumbotron">
<div class="container container-fluid">
<div class="row">
<div class="col-md-12 midden ">
<ol>
<li>Contact</li>
<li>Work</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-3-offset-3">
<h1>Noah Wallaart</h1>
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
When you're using Bootstrap, you don't want to overwrite the properties provided by the framework. Instead all you need to do is give the container the text-center class and it should work fine.
<div class="jumbotron">
<div class="container container-fluid">
<div class="row">
<div class="col-md-12 text-center"> <!-- THIS LINE CHANGED -->
<ol>
<li>Contact</li>
<li>Work</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-3-offset-3">
<h1>Noah Wallaart</h1>
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
Related
Im to html and css and im trying to make a game website for my school but when i try to change div into a on for the card it moves the card down the page as seen in the images bellow,if you guys have any ideas why this is doing this please help im sort of stuck and I want to fiqure this out before I continue with this page.
Before Change
Before
After Change
After
<!DOCTYPE html>
<head>
<meta charset="utf-8"/>
<title>Project-LuLo</title>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
.shell{
justify-content:center;
display: flex;
flex-direction:row;
flex-basis: auto;
margin:5px;
}
.card {
width: 175px;
display: flex;
flex-direction: column;
border: 1px solid #EF9A9A;
border-radius: 4px;
overflow: hidden;
margin: 10px;
text-decoration:none;
}
.card-header {
color: #D32F2F;
text-align: center;
font-size: 18px;
font-weight: 600;
border-bottom: 1px solid #EF9A9A;
background-color: #FFEBEE;
padding: 5px 10px;
}
.card-main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 15px 0;
}
.material-icons {
font-size: 72px;
margin-bottom: 5px;
color: #D32F2F;
}
.main-description {
color: #D32F2F;
font-size: px;
text-align: center;
}
* {box-sizing: border-box;}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.header {
overflow: hidden;
background-color: #FFEBEE;
padding: 20px 10px;
border-bottom: 1px solid #EF9A9A;
border-radius: 4px;
}
.header a {
float: left;
color: #D32F2F;
text-align: center;
padding: 12px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
}
.header a.logo {
font-size: 25px;
font-weight: bold;
}
.header a:hover {
background-color: #dfd5d7;
color: #942626;
}
.header a.active {
background-color: #D32F2F;
color: #FFEBEE;
}
.header-right {
float: right;
}
#media screen and (max-width: 500px) {
.header a {
float: none;
display: block;
text-align: left;
}
.header-right {
float: none;
}
}
</style>
</head>
<body>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
<div class="header">
Project-LuLo
<div class="header-right">
<a class="active" href="#home">Home</a>
Games
Contact
</div>
</div>
<div class="shell">
<a href = "#test"class="card">
<div class="card-header">Games</div>
<div class="card-main">
<i class="material-icons">videogame_asset</i>
<div class="main-description">Web Based Games</div>
</div>
</div>
<a href="#test"class="card">
<div class="card-header">Other</div>
<div class="card-main">
<i class="material-icons">question_mark</i>
<div class="main-description">Cool Random Stuff</div>
</div>
</div>
</div>
</body>
</html>
There was a few unclosed <a> tags and when you changed one of the tags to an <a> it also was removed from inside the <div> that contained your shell class which was the flex element that was holding the 2 cards beside each-other
body {
font-family: 'Open Sans', sans-serif;
}
.shell{
justify-content:center;
display: flex;
flex-direction:row;
flex-basis: auto;
margin:5px;
}
.card {
width: 175px;
display: flex;
flex-direction: column;
border: 1px solid #EF9A9A;
border-radius: 4px;
overflow: hidden;
margin: 10px;
text-decoration:none;
}
.card-header {
color: #D32F2F;
text-align: center;
font-size: 18px;
font-weight: 600;
border-bottom: 1px solid #EF9A9A;
background-color: #FFEBEE;
padding: 5px 10px;
}
.card-main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 15px 0;
}
.material-icons {
font-size: 72px;
margin-bottom: 5px;
color: #D32F2F;
}
.main-description {
color: #D32F2F;
font-size: px;
text-align: center;
}
* {box-sizing: border-box;}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.header {
overflow: hidden;
background-color: #FFEBEE;
padding: 20px 10px;
border-bottom: 1px solid #EF9A9A;
border-radius: 4px;
}
.header a {
float: left;
color: #D32F2F;
text-align: center;
padding: 12px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
}
.header a.logo {
font-size: 25px;
font-weight: bold;
}
.header a:hover {
background-color: #dfd5d7;
color: #942626;
}
.header a.active {
background-color: #D32F2F;
color: #FFEBEE;
}
.header-right {
float: right;
}
#media screen and (max-width: 500px) {
.header a {
float: none;
display: block;
text-align: left;
}
.header-right {
float: none;
}
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
<div class="header">
Project-LuLo
<div class="header-right">
<a class="active" href="#home">Home</a>
Games
Contact
</div>
</div>
<div class="shell">
<a href="#test" class="card">
<div class="card-header">Games</div>
<div class="card-main">
<i class="material-icons">videogame_asset</i>
<div class="main-description">Web Based Games</div>
</div>
</a>
<a href="#test"class="card">
<div class="card-header">Other</div>
<div class="card-main">
<i class="material-icons">question_mark</i>
<div class="main-description">Cool Random Stuff</div>
</div>
</a>
</div>
I have a navigation menu that's fixed in the left inside a div.
I want to be able to put a logo right next to it, centered, but to the right of the menu.
I'm not able to realise what I have to do in the code in order to get it
I tried using a div inside the div, but that does not do it
* {
background-color: black
}
* {
padding: 0;
margin: 0;
}
.navigation {
z-index: 1;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 20px;
font-weight: bold;
border-style: dashed;
border-color: green;
border-radius: 20px;
height: 80px;
width: 750px;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 10px 12px;
text-decoration: none;
border-style: dotted;
margin-left: 24px;
margin-top: 11px;
}
li a:hover {
background-color: red;
}
.parrafo {
font-size: 40px;
padding: 75px;
border-radius: 10px;
margin-top: 10px;
margin-bottom: 10px;
border-left: 22px;
padding-left: 150px;
border-top: dotted 5px red;
border-bottom: dotted 5px yellowgreen;
display: flex;
flex-direction: row;
font-family: sans-serif;
font-weight: bold;
color: white;
}
.queonda {
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}
.test {
margin-left: 200px;
margin-top: 270px;
}
.test2 {
margin-top: 100px;
margin-bottom: 100px;
margin-left: 750px;
}
.portrait {
overflow: hidden;
display: inline-block;
}
.portrait img {
transition: transform 0.5s linear;
background-image: cover;
}
.portrait:hover img {
transform: scale(1.1);
}
.cat {
height: 1250px;
width: 1900px;
}
.algo {
height: 100vh;
width: 100vw;
}
.active {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.ptm {
font-size: 70px;
color: white;
position: right;
margin-right: 500px;
display: inline;
}
<div class="navigation active">
<ul>
<li>Tour</li>
<li>Listen to Music</li>
<li>Contact</li>
<li>About</li>
</ul>
</div>
<div class="portrait algo"><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>
<div class="parrafo">
<img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
<P class="test">MUSIC<br>MAINSTREAM SELLOUT</P>
</div>
<div class="test2">
<P class="queonda">VIDEOS</P><br><br>
<video width="1280" controls autoplay="off">
<source src="./img/prueba2.mp4" type="video/mp4">
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Terms & Conditions</h4>
</div>
<div class="footer-col">
<h4><a class="textDecoration" href="#privacy">Privacy and Policy</a></h4>
</div>
<div class="footer-col">
<h4>Follow Us</h4>
<div class="social-links">
</div>
</div>
<div class="footer-col">
<div class="social-links">
<h3>
</h3>
</div>
</div>
</div>
</footer>
I would really appreciate your help with this
If you want it in the menu but next to it, you should just add the logo as a list item. Then you can give it a class (I called it logo) to reposition it.
See below:
* {
background-color: black
}
* {
padding: 0;
margin: 0;
}
.navigation {
z-index: 1;
}
.logo {
padding: 6px;
border: 0;
margin-left: 4em;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 20px;
font-weight: bold;
border-style: dashed;
border-color: green;
border-radius: 20px;
height: 80px;
width: 750px;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 10px 12px;
text-decoration: none;
border-style: dotted;
margin-left: 24px;
margin-top: 11px;
}
li a:hover {
background-color: red;
}
.parrafo {
font-size: 40px;
padding: 75px;
border-radius: 10px;
margin-top: 10px;
margin-bottom: 10px;
border-left: 22px;
padding-left: 150px;
border-top: dotted 5px red;
border-bottom: dotted 5px yellowgreen;
display: flex;
flex-direction: row;
font-family: sans-serif;
font-weight: bold;
color: white;
}
.queonda {
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}
.test {
margin-left: 200px;
margin-top: 270px;
}
.test2 {
margin-top: 100px;
margin-bottom: 100px;
margin-left: 750px;
}
.portrait {
overflow: hidden;
display: inline-block;
}
.portrait img {
transition: transform 0.5s linear;
background-image: cover;
}
.portrait:hover img {
transform: scale(1.1);
}
.cat {
height: 1250px;
width: 1900px;
}
.algo {
height: 100vh;
width: 100vw;
}
.active {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.ptm {
font-size: 70px;
color: white;
position: right;
margin-right: 500px;
display: inline;
}
<div class="navigation active">
<ul>
<li>Tour</li>
<li>Listen to Music</li>
<li>Contact</li>
<li>About</li>
<li>
<a class="logo"><img src="https://dummyimage.com/40/#41404/fff"></a>
</li>
</ul>
</div>
<div class="portrait algo"><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>
<div class="parrafo">
<img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
<P class="test">MUSIC<br>MAINSTREAM SELLOUT</P>
</div>
<div class="test2">
<P class="queonda">VIDEOS</P><br><br>
<video width="1280" controls autoplay="off">
<source src="./img/prueba2.mp4" type="video/mp4"></video>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Terms & Conditions</h4>
</div>
<div class="footer-col">
<h4><a class="textDecoration" href="#privacy">Privacy and Policy</a></h4>
</div>
<div class="footer-col">
<h4>Follow Us</h4>
<div class="social-links">
</div>
</div>
<div class="footer-col">
<div class="social-links">
<h3>
</h3>
</div>
</div>
</div>
</div>
</footer>
Side note: forgot to close </video> and the .container div which was making your HTML invalid.
i am a 17 year old boy and recently new at using html and css ,i have been making a website and i am trying to add a drop down menu on my existing website but i am struggling to do so as everything , i want a drop down menu on my photos tab so that i can add some pictures and one in my "ABOUT" tab as well , i tried is not working , any help will be appreciated and welcomed. Thanks in advance
*
{
margin: 0;
padding: 0;
}
header
{
background-image:linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0.5)),url(1493004618106.jpg);
height: 100vh;
background-size: cover;
background-position: center;
}
.main-nav
{
float: right;
list-style: none;
margin-top: 30px;
}
.main-nav li
{
display: inline-block;
}
.main-nav li a
{
color: white;
text-decoration: none;
padding; 5px 20px;
font-family: "Roboto", sans-serif;
font-size: 15px;
}
.main-nav li.active a
{
border: 1px solid white;
}
.main-nav li a:hover
{
border: 1px solid white;
}
.logo img
{
width: 100px;
height: auto;
float: left;
}
body
{
font-family: monospace;
}
.row
{
max-width: 1200px
margin: auto;
}
.hero
{
position: absolute;
width: 1000px;
margin-left: 200px;
margin-top: 0px;
margin-right: 50px;
}
h1
{
color: white;
text-transform: uppercase;
font-size: 70px;
text-align: center;
margin-top: 275px;
}
.button
{
margin-top: 30px;
margin-left: 330px;
}
.btn
{
border : 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
margin-right: 5px;
font-size: 13px;
text-transform: uppercase
}
.btn-one
{
background-color: darkblue;
font-family: "Roboto", sans-serif;
}
.btn-two
{
font-family: "Roboto", sans-serif
}
.btn-two:hover
{
background-color: darkblue
}
index.html
<html>
<head>
<title>Bryan's Holidays</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div class="row">
<div class="logo">
<img src="fr.png">
</div>
<ul class="main-nav">
<li class="active"> HOME</li>
<li> ABOUT</li>
<li> PHOTOS</li>
<li> CONTACT</li>
</ul>
</div>
<div class="hero">
<h1>WELCOME!</h1>
<div class="button">
Watch video
Explore more
</div>
</div>
</header>
</body>
</html>
Does this help you?
https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_dropdown_hover
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<body>
<div class="w3-container">
<h2>Dropdown Button</h2>
<p>Move the mouse over the button to open the dropdown content.</p>
<div class="w3-dropdown-hover">
<button class="w3-button w3-black">Hover Over Me!</button>
<div class="w3-dropdown-content w3-bar-block w3-border">
Link 1
Link 2
Link 3
</div>
</div>
</div>
</body>
</html>
I didn't change too much of your code, just some designs and dynamics. Please sort your code later, it's a bit confusing.
CSS
{
margin: 0;
padding: 0;
}
header
{
background-image:linear-gradient(rgba(0,0,0,0.5),rgba(0,0,0,0.5)),url(1493004618106.jpg);
height: 100vh;
background-size: cover;
background-position: center;
}
.main-nav
{
float: right;
list-style: none;
margin-top: 30px;
}
.main-nav li
{
display: inline-block;
}
.main-nav li a
{
color: white;
text-decoration: none;
padding; 5px 20px;
font-family: "Roboto", sans-serif;
font-size: 15px;
}
.main-nav li.active a
{
border: 1px solid white;
}
.main-nav li a:hover
{
border: 1px solid white;
}
.logo img
{
width: 100px;
height: auto;
float: left;
}
body
{
font-family: monospace;
}
.row
{
max-width: 1200px
margin: auto;
padding-top: 10px;
}
.hero
{
position: absolute;
width: 1000px;
margin-left: 200px;
margin-top: 0px;
margin-right: 50px;
}
h1
{
color: white;
text-transform: uppercase;
font-size: 70px;
text-align: center;
margin-top: 275px;
}
.button
{
margin-top: 30px;
margin-left: 330px;
}
.btn
{
border : 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
margin-right: 5px;
font-size: 13px;
text-transform: uppercase
}
.btn-one
{
background-color: darkblue;
font-family: "Roboto", sans-serif;
}
.btn-two
{
font-family: "Roboto", sans-serif
}
.btn-two:hover
{
background-color: darkblue
}
.float-right{
margin-left: 60%
}
.dropbtn {
background-color: #464;
border-radius: 5px;
color: white;
padding: 16px;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #3e8e41;}
HTML
<html>
<head>
<title>Bryan's Holidays</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div class="row" style="">
<div class="logo">
<img src="fr.png">
</div>
<div class="float-right">
<!-- ++++++++ Home -->
<button class="dropbtn">Home</button>
<!-- ++++++++ About -->
<div class="dropdown">
<button class="dropbtn">About</button>
<div class="dropdown-content">
Link 4
Link 5
Link 6
</div>
</div>
<!-- ++++++++ Photos -->
<div class="dropdown">
<button class="dropbtn">Photos</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<!-- ++++++++ Contact -->
<button class="dropbtn">Contact</button>
</div>
</div>
<div class="hero">
<h1>WELCOME!</h1>
<div class="button">
Watch video
Explore more
</div>
</div>
</header>
</body>
</html>
I've been trying to get the "Header" text to be centered and the icon to stay.
text-align: center; won't work for me.
Anyone can lead me in the right direction?
Thanks.
IMG:
.header {
padding-top: 15px;
padding-bottom: 15px;
color: #fff;
background: #333;
}
.header a {
text-align: center;
text-decoration: none;
color: #fff;
font-size: 32px;
vertical-align: middle;
}
#hamburger {
color: white;
font-size: 32px;
}
.menu {
display: inline-block;
}
<div class="headerwrapper">
<div class="header">
<div class="menuWrap">
<div class="menu open">
<span id="hamburger" class="fas fa-bars hvr-grow"></span>
</div>
Header
</div>
</div>
</div>
You should put text-align:center into your .header class.
In addition to that you also should put float:left; property in the .menu class.
Here is the example:
.header {
padding-top: 15px;
padding-bottom: 15px;
color: #fff;
background: #333;
text-align:center;
}
.header a {
text-align: center;
text-decoration: none;
color: #fff;
font-size: 32px;
vertical-align: middle;
}
#hamburger {
color: white;
font-size: 32px;
}
.menu {
display: inline-block;
float:left;
}
<div class="headerwrapper">
<div class="header">
<div class="menuWrap">
<div class="menu open">
<span id="hamburger" class="fas fa-bars hvr-grow">a</span>
</div>
Header
</div>
</div>
</div>
The centering can be done with text-align: center; on .header.
However, this will also affect your hamburger icon (which I replaced with an "X" below to make it visible), so apply position: absolute to its container .menu and use the left parameter to define the distance from the left border:
.header {
padding-top: 15px;
padding-bottom: 15px;
color: #fff;
background: #333;
text-align: center;
}
.header a {
text-align: center;
text-decoration: none;
color: #fff;
font-size: 32px;
}
#hamburger {
color: white;
font-size: 32px;
}
.menu {
position: absolute;
left: 30px;
}
<div class="headerwrapper">
<div class="header">
<div class="menuWrap">
<div class="menu open">
<span id="hamburger" class="fas fa-bars hvr-grow">X</span>
</div>
Header
</div>
</div>
</div>
.header {
padding-top: 15px;
padding-bottom: 15px;
color: #fff;
background: #333;
text-align: center;
}
.header a {
text-align: center;
text-decoration: none;
color: #fff;
font-size: 32px;
vertical-align: middle;
}
#hamburger {
color: white;
font-size: 32px;
}
.menu {
display: inline-block;
vertical-align: middle;
float: left;
padding: 0 0 0 15px;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<div class="headerwrapper">
<div class="header">
<div class="menuWrap">
<div class="menu open">
<span id="hamburger" class="fas fa-bars hvr-grow"></span>
</div>
Header
</div>
</div>
</div>
You need to add text-align to your header class .header, it should look similar to this
.header {
padding-top: 15px;
padding-bottom: 15px;
color: #fff;
background: #333;
text-align: center;
}
Change Like This:
.header a {
position: absolute;
left: 50%;
transform: translate(-50%);
//Other css...
}
.header {
padding-top: 15px;
padding-bottom: 15px;
color: #fff;
background: #333;
}
.header a {
text-align: center;
text-decoration: none;
color: #fff;
font-size: 32px;
vertical-align: middle;
position: absolute;
left: 50%;
transform: translate(-50%);
}
#hamburger {
color: white;
font-size: 32px;
}
.menu {
display: inline-block;
}
<div class="headerwrapper">
<div class="header">
<div class="menuWrap">
<div class="menu open">
<span id="hamburger" class="fas fa-bars hvr-grow">Icon</span>
</div>
Header
</div>
</div>
</div>
I am designing my first site... the footer section to be specific. I am trying to style the <a> tags into a white color without the default webkit styling but I am unable to do so.
What am I doing wrong, and how can I change the styling?
* {
margin: 0px;
padding: 0px;
}
div {
display: block;
}
.header {
background-color: #333333;
}
.nav {
padding: 0px auto;
margin: 0px auto;
}
.nav ul {
}
.nav ul li {
color: #e6e6e6;
display: inline-block;
padding: 20px 30px 20px 20px ;
font-family: 'raleway', sans-serif;
font-weight: 20px;
}
.nav ul li a {
text-decoration: none;
color: #efefef;
padding: 20px 20px 20px 20px ;
font-family: 'raleway', sans-serif;
font-weight: 20px;
}
.nav ul li a:hover {
color: #efefef;
background-color: #191919;
transition: background .5s;
}
.second_section .container {
background-image: url(http://1.bp.blogspot.com/-I0jOcWYqW94/UdFZ9U8Si0I/AAAAAAAACRw/2Hhb0xY7yzY/s1600/84.jpg);
height: 900px;
width: 100%;
}
.copy {
position: absolute;
margin: 100px 50px 500px 500px;
color: white;
font-family: 'Josefin Sans', sans-serif;
letter-spacing: 2px
}
.copy {
text-align: center;
}
.btn_section {
top: 400px;
text-align: center;
position: relative;
}
.btn {
position: relative;
margin-top: 100px
color: white;
border: solid 2px fixed;
}
.btn_section a {
border: 1px solid white;
padding: 20px 40px;
text-decoration: none;
background-color: #191919;
color: white;
font-family: 'Open Sans', sans-serif;
font-size: 1.33em;
letter-spacing: 2px;
text-transform: uppercase;
}
.btn_section a:hover {
background-color: #e6e6e6;
color: #191919;
transition: background .5s;
cursor: pointer;
}
.third_section a: hover {
background-color: black;
}
.third_section {
height: 20px;
background-color: black;
}
.fourth_section .col {
display: inline-block;
padding-top: 50px;
padding-bottom: 75px;
padding-left: 6%;
padding-right: 6%;
text-align: center;
font-family: 'Raleway';
width: 20%;
vertical-align: top;
}
.fourth_section img {
padding: 5px 5px 10px 5px;
height: 32px
}
.fourth_section > h2 {
font-family: 'Raleway';
font-size: 1.33em;
}
.col > p {
font-size: 1.12em;
}
.col a {
text-decoration: none;
color: #323232;
}
.col {
text-align: center;
font-family: Garamond;
}
.footer {
height: 100px;
background-color: #333;
padding: 20px;
}
.footer a {
text-decoration: none;
}
.footer_info {
position: relative;
text-decoration: none;
margin-bottom: 10px;
color: white;
}
<div class="header">
<div class="nav">
<ul>
<li>ABOUT</li>
<li>WORK</li>
<li>TEAM</li>
<li>CONTACT</li>
</div>
</div>
<div class="second_section">
<div class="container">
<div class="copy">
<h1>ACTUATE CONTENT</h1>
<br>
<h3>Expert content for every business</h3>
</div>
<div class="btn_section">
Write For Me!
</div>
</div>
<div class="third_section">
</div>
<div class="fourth_section">
<div class="col">
<img src="https://cdn0.iconfinder.com/data/icons/seo-smart-pack/128/grey_new_seo2-17-256.png"><h2>RESEARCH</h2>
<br>
<p>Our meticulous research methods will uncover the most relevant information for your project. </p>
</div>
<div class="col">
<a href="#"><img src="https://cdn2.iconfinder.com/data/icons/55-files-and-documents/512/Icon_17-512.png">
<h2>WRITING</h2></a>
<br>
<p>Our seasoned, handpicked writers craft stellar content for your specific needs.</p>
</div>
<div class="col">
<a href="#"><img src="http://i.imgur.com/AinCaug.png">
<h2>EDITING</h2></a>
<br>
<p>Our editors work with leading authors and publishers to bring out the best in their writing.</p>
</div>
</div>
<div class="footer">
<div class="footer_info">
<p>Terms of Use / Privacy Policy</p>
</div>
</div>
Add your styles into this :
.footer .footer_info a {
...
}