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>
Related
https://sagarj2021.github.io/first-website/
This is my website but it only open fullscreen in destop of my laptop. It does not open in fullscreen in smartphones destop as well as in normal search. (Actully in smartphone right side is 50% of white blank color). I dont know how to fix this issue..
I have given my code also,
so please can you help mi ?
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.hero {
height: 100vh;
width: 100%;
background-color: black;
background-size: cover;
background-position: center;
}
nav {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 45px;
padding-left: 8%;
padding-right: 8%;
}
.logo {
color: white;
font-size: 35px;
letter-spacing: 1px;
cursor: pointer;
}
span {
color: red;
}
nav ul li {
list-style-type: none;
display: inline-block;
padding: 10px 25px;
}
nav ul li a {
color: white;
text-decoration: none;
font-weight: bold;
text-transform: capitalize;
}
nav ul li a:hover {
color: red;
transition: .4s;
}
.btn {
background-color: red;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 10px 25px;
border-radius: 30px;
transition: transform .4s;
}
.btn:hover {
transform: scale(1.2);
}
.content {
position: absolute;
top: 50%;
left: 8%;
transform: translateY(-50%);
}
h1 {
color: white;
margin: 20px 0px 20px;
font-size: 75px;
}
h3 {
color: white;
font-size: 25px;
margin-bottom: 50px;
}
h4 {
color: #fcfc;
letter-spacing: 2px;
font-size: 20px;
}
.newslatter form {
width: 380px;
max-width: 100%;
position: relative;
}
.newslatter form input:first-child {
display: inline-block;
width: 100%;
padding: 14px 130px 14px 15px;
border: 2px solid #f9004d;
outline: none;
border-radius: 30px;
}
.newslatter form input:last-child {
position: absolute;
display: inline-block;
outline: none;
border: none;
padding: 10px 30px;
border-radius: 30px;
background-color: #f9004d;
color: white;
box-shadow: 0px 0px 5px #000, 0px 0px 15px #858585;
top: 6px;
right: 6px;
}
.about {
width: 100%;
padding: 100px 0px;
background-color: #191919;
}
.about img {
height: auto;
width: 430px;
}
.about-text {
width: 550px;
}
.main {
width: 1130px;
max-width: 95%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-around;
}
.about-text h2 {
color: white;
font-size: 75px;
text-transform: capitalize;
margin-bottom: 20px;
}
.about-text h5 {
color: white;
letter-spacing: 2px;
font-size: 22px;
margin-bottom: 25px;
text-transform: capitalize;
}
.about-text p {
color: #fcfc;
letter-spacing: 1px;
line-height: 28px;
font-size: 18px;
margin-bottom: 45px;
}
button {
background-color: #f9004d;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 13px 30px;
border-radius: 30px;
transition: .4s;
}
button:hover {
background-color: transparent;
border: 2px solid #f9004d;
cursor: pointer;
}
.service {
background: #101010;
width: 100%;
padding: 100px 0px;
}
.title h2 {
color: white;
font-size: 75px;
width: 1130px;
margin: 30px auto;
text-align: center;
}
.box {
display: flex;
justify-content: center;
align-items: center;
min-height: 400px;
}
.card {
height: 365px;
width: 335px;
padding: 20px 35px;
background: #191919;
border-radius: 20px;
margin: 15px;
position: relative;
overflow: hidden;
text-align: center;
}
.card i {
font-size: 50px;
display: block;
text-align: center;
margin: 25px 0px;
color: #f9004d;
}
h5 {
color: white;
font-size: 23px;
margin-bottom: 15px;
}
.pra p {
color: #fcfc;
font-size: 16px;
line-height: 27px;
margin-bottom: 25px;
}
.card .button {
background-color: #f9004d;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 9px 22px;
border-radius: 30px;
transition: .4s;
}
.card .button:hover {
background-color: transparent;
border: 2px solid #f9004d;
cursor: pointer;
}
.contact-me {
width: 100%;
height: 290px;
background: #191919;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.contact-me p {
color: white;
font-size: 30px;
font-weight: bold;
margin-bottom: 25px;
}
.contact-me .button-two {
background-color: #f9004d;
color: white;
text-decoration: none;
border: 2px solid transparent;
font-weight: bold;
padding: 13px 30px;
border-radius: 30px;
transition: .4s;
}
.contact-me .button-two:hover {
background-color: transparent;
border: 2px solid #f9004d;
cursor: pointer;
}
footer {
position: relative;
width: 100%;
height: 400px;
background: #101010;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
footer p:nth-child(1) {
font-size: 30px;
color: white;
margin-bottom: 20px;
font-weight: bold;
}
footer p:nth-child(2) {
color: white;
font-size: 17px;
width: 500px;
text-align: center;
line-height: 26px;
}
.social {
display: flex;
}
.social a {
width: 45px;
height: 45px;
display: flex;
align-items: center;
justify-content: center;
background: #f9004d;
border-radius: 50%;
margin: 22px 10px;
color: white;
text-decoration: none;
font-size: 20px;
}
.social a:hover {
transform: scale(1.3);
transition: .3s;
}
.end {
position: absolute;
color: #f9004d;
bottom: 35px;
font-size: 14px;
}
<!--Sagar personal website-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="personalprofile.css">
<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=Roboto&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/34d51c031e.js" crossorigin="anonymous"></script>
<title>Personal website</title>
</head>
<body>
<div class="hero">
<nav>
<h2 class="logo">Portfo<span>lio</span></h2>
<ul>
<li>Home</li>
<li>About</li>
<li>Gallery</li>
<li>Contact</li>
</ul>
Blog
</nav>
<div class="content">
<h4>hello, my name is</h4>
<h1>Sagar<span>Jadhav</span></h1>
<h3>I'm a Web Developer.</h3>
<div class="newslatter">
<form action="">
<input type="email" name="email" id="mail" placeholder="Enter Your Email">
<input type="submit" name="submit" value="Let start">
</form>
</div>
</div>
</div>
<!---About section start-->
<section class="about">
<div class="main">
<img src="#" alt="">
<div class="about-text">
<h2>About Me</h2>
<h5>Developer & Designer</h5>
<p>
I am a front-end web developer. I can provide clean code and pixel perfect design. I also make the website more & more interactive with web animations. I can provide clean code and pixel perfect design. I also make the website more & more interactive
with web animations. A responsive design makes your website accessible to all users, regardless of their devices.
</p>
<button type="button">Let's Talk</button>
</div>
</div>
</section>
<!--Service section start-->
<div class="service">
<div class="title">
<h2>Our Services</h2>
</div>
<div class="box">
<div class="card">
<i class="fas fa-bars"></i>
<h5>Web Development</h5>
<div class="pra">
<p>Every website should be built with two primary goals: Firstly, it needs to work across all devices. Secondly, it needs to be fast as possible. </p>
<p style="text-align: center;">
<a class="button" href="#">Read More</a>
</p>
</div>
</div>
<div class="card">
<i class="fa-regular fa-user"></i>
<h5>Web Development</h5>
<div class="pra">
<p>Every website should be built with two primary goals: Firstly, it needs to work across all devices. Secondly, it needs to be fast as possible. </p>
<p style="text-align: center;">
<a class="button" href="#">Read More</a>
</p>
</div>
</div>
<div class="card">
<i class="fa-regular fa-bell"></i>
<h5>Web Development</h5>
<div class="pra">
<p>Every website should be built with two primary goals: Firstly, it needs to work across all devices. Secondly, it needs to be fast as possible. </p>
<p style="text-align: center;">
<a class="button" href="#">Read More</a>
</p>
</div>
</div>
</div>
</div>
<!--Contact Me-->
<div class="contact-me">
<p>For any help.</p>
<a class="button-two" href="#">Contact Me</a>
</div>
<!--Footer start-->
<footer>
<p>Sagar Jadhav</p>
<p>For coding and syber security related update follow my blog chennal - please click on the link below to follow me:
</p>
<div class="social">
<i class="fa-brands fa-facebook"></i>
<i class="fa-brands fa-instagram"></i>
<i class="fa-brands fa-linkedin"></i>
</div>
<p class="end">CopyRight By Sagar Jadhav</p>
</footer>
</body>
</html>
Replace this code in your code
.title h2 {
color: white;
font-size: 75px;
width: 130px;
margin: 30px auto;
text-align: center;
}
I am trying to build my personal webpage but simply cant manage to make my footer not cover the two buttons.
This problem only occurs on my laptop. As soon as I switch to my external monitor, the two buttons arent covered anymore.
I have tried inserting html{overflow-y: scroll;} to my css but it doesnt seem to work :(
Any help would be awesome! Thank you.
HTML:
#import url('https://fonts.googleapis.com/css?family=Roboto:700&display=swap');
* {
padding: 0;
margin: 0;
}
body {
background-color: ghostwhite;
background-size: cover;
padding: 0;
margin: 0;
}
.navbar {
height: 80px;
width: 100%;
background-color: #808080;
}
.logo {
width: 140px;
height: auto;
padding: 15px 50px;
}
.navbar ul {
float: right;
margin-right: 20px;
}
.navbar ul li {
list-style: none;
margin: 0 8px;
display: inline-block;
line-height: 80px;
}
.navbar ul li a {
text-decoration: none;
color: white;
font-size: 20px;
padding: 2px 6px;
font-family: 'Roboto', sans-serif;
transition: .2s;
}
.navbar ul li a:hover {
background: lightsteelblue;
border-radius: 2px;
}
.wrapper .center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-family: sans-serif;
user-select: none;
}
.center h1 {
color: black;
font-size: 70px;
font-weight: bold;
width: 900px;
text-align: center;
}
.center h2 {
color: black;
font-size: 70px;
font-weight: bold;
width: 885px;
margin-top: 10px;
text-align: center;
}
.center .buttons {
margin: 35px 280px;
}
.buttons button {
height: 50px;
width: 150px;
font-size: 18px;
font-weight: bold;
color: white;
background-color: lightsteelblue;
border: 1px solid #4b79b4;
outline: none;
cursor: pointer;
border-radius: 25px;
transition: .5s;
}
.buttons .btn {
margin-left: 25px;
}
.buttons button:hover {
background: #4b79b4;
}
footer {
position: absolute;
background-color: #808080;
height: auto;
width: 100%;
padding-top: 40px;
color: black;
bottom: 0px;
}
.footer-content {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
text-align: center;
}
.footer-content h3 {
font-size: 1.8rem;
font-weight: 400;
text-transform: capitalize;
line-height: 3rem;
}
.footer-content p {
max-width: 500px;
margin: 10px auto;
line-height: 28px;
font-size: 14px;
}
.socials {
list-style: none;
display: flex;
align-items: center;
justify-content: center;
margin: 1rem 0 3rem 0;
}
.socials li {
margin: 0 10px;
}
.socials a {
text-decoration: none;
color: lightsteelblue;
}
.socials a i {
font-size: 1.1rem;
transition: color .4s ease;
}
.socials a:hover i {
color: #4b79b4;
}
.footer-bottom {
background-color: #737373;
width: 100%;
padding: 20px 0;
text-align: center;
}
.footer-bottom p {
font-size: 14px;
word-spacing: 2px;
text-transform: capitalize;
}
.footer-bottom span {
text-transform: uppercase;
opacity: .4;
font-weight: 200;
}
<!doctype html>
<html lang="en ">
<head>
<meta charset="utf-8">
<title>Moritz </title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="wrapper">
<!-- BEGIN NAVBAR -->
<nav class="navbar">
<img class="logo" src="logo.png">
<ul>
<li> <a class="active" href="#">Home</a></li>
<li> About</li>
<li> CV</li>
<li> Favourites</li>
<li> Contact</li>
</ul>
</nav>
<!-- END NAVBAR -->
<!-- BEGIN CONTENT -->
<div class="center">
<h1>Hi, I'm Moritz.</h1>
<h2>I'm a student.</h2>
<div class="buttons">
<button>Explore more</button>
<button class="btn">Contact me</button>
</div>
<!-- END CONTENT -->
</div>
<!-- BEGIN FOOTER -->
<footer>
<div class="footer-content">
<h3>Moritz </h3>
<p>Thank you for browsing. I hope to hear from you soon!</p>
<ul class="socials">
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-linkedin-square"></i></li>
<li><i class="fa fa-envelope"></i></li>
<li><i class="fa fa-phone"></i></li>
</ul>
</div>
<div class="footer-bottom">
<p> Copyright © 2021 Moritz </p>
</div>
</footer>
<!-- END FOOTER -->
</body>
</html>
What you describe kind of feels like a grid to me using three "rows", one for the "navbar", one for the "content" and one for the "footer" such as:
display: grid;
grid-template-rows: auto 1fr auto;
Now given that we can put the containers for the rows in a wrapper .wrapper
Then we tall it which "row" each of the sections belongs in. grid-row: 2/2; for the content for example in row 2 (start and end)
I took a good bit of liberty with your CSS (it is still a "lot" just for this) specifically, I added borders to show where things are - you will want to remove those but I did it to illustrate where is "is" in the flow.
This is by no means "perfect" but just a very quick place to build from.
#import url('https://fonts.googleapis.com/css?family=Roboto:700&display=swap');
* {
padding: 0;
margin: 0;
}
body {
background-color: ghostwhite;
padding: 0;
margin: 0;
border: solid orange 3px;
}
.wrapper {
display: grid;
grid-template-rows: auto 1fr auto;
border: lime 4px dashed;
}
.navbar-container {
border: red 4px solid;
grid-row: 1/1;
display: flex;
align-items: start;
margin: 0rem;
}
.content-container {
font-family: sans-serif;
display: grid;
place-items: center;
grid-row: 2/2;
border: blue 1px solid;
}
.footer-container {
padding-top: 2rem;
display: grid;
grid-template-rows: auto 1fr auto;
border: cyan 1px solid;
}
.footer-content {
display: grid;
grid-template-rows: 1fr auto 1fr;
align-items: center;
justify-items: center;
}
.footer-bottom {
grid-row: 3/3;
align-text: center;
padding: 0.25rem;
border: dashed blue 1px;
}
.navbar {
height: 5rem;
width: 100%;
background-color: #808080;
font-family: 'Roboto', sans-serif;
}
.navbar>.logo {
width: 140px;
height: auto;
padding-bottom: 15px;
padding-top: 15px;
padding-left: 50px;
padding-right: 50px;
border: solid 1px green;
}
.navbar ul li {
list-style: none;
margin: 0 8px;
display: inline-block;
line-height: 80px;
}
.navbar ul li a {
text-decoration: none;
color: white;
font-size: 20px;
padding: 2px 6px;
transition: 0.2s;
}
.navbar ul li a:hover {
background: lightsteelblue;
border-radius: 2px;
}
.wrapper .center {
user-select: none;
}
.buttons {
display: flex;
flex-direction: row;
margin-top: 1rem;
margin-bottom: 1rem;
}
.buttons button {
margin: 1rem;
}
.buttons button {
flex: auto;
height: 50px;
width: 150px;
font-size: 18px;
font-weight: bold;
color: white;
background-color: lightsteelblue;
border: 1px solid #4b79b4;
outline: none;
cursor: pointer;
border-radius: 25px;
transition: .5s;
}
.buttons button:hover {
background: #4b79b4;
}
.socials {
list-style: none;
display: flex;
align-items: middle;
justify-content: center;
}
.socials li {
margin-right: 10px;
}
.footer-bottom {
font-size: 0.75rem;
background-color: #737373;
text-align: center;
width: 100%;
text-transform: uppercase;
opacity: .4;
font-weight: 200;
}
<!doctype html>
<html lang="en ">
<head>
<meta charset="utf-8">
<title>Moritz </title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="wrapper">
<nav class="navbar navbar-container">
<img class="logo" src="logo.png">
<ul class="menu-items">
<li> <a class="active" href="#">Home</a></li>
<li> About</li>
<li> CV</li>
<li> Favourites</li>
<li> Contact</li>
</ul>
</nav>
<div class="center content-container">
<h1>Hi, I'm Moritz.</h1>
<h2>I'm a student.</h2>
<div class="buttons">
<button>Explore more</button>
<button class="btn">Contact me</button>
</div>
</div>
<footer class="footer-container">
<div class="footer-content">
<h3>Moritz </h3>
<p>Thank you for browsing. I hope to hear from you soon!</p>
<ul class="socials">
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-linkedin-square"></i></li>
<li><i class="fa fa-envelope"></i></li>
<li><i class="fa fa-phone"></i></li>
</ul>
</div>
<div class="footer-bottom">
<p> Copyright © 2021 Moritz </p>
</div>
</footer>
</body>
</html>
#import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
.content1{
position: relative;
margin: 130px auto;
text-align: center;
padding: 0 20px;
}
.content1 .text{
font-size: 2.5rem;
font-weight: 600;
color: #202020;
}
.content1 .p{
font-size: 2.1875rem;
font-weight: 600;
color: #202020;
}
footer{
position: relative;
bottom: 0px;
width: 100%;
background: #111;
}
.main-content{
display: flex;
color: #d9d9d9;
}
.main-content .box{
flex-basis: 50%;
padding: 10px 20px;
}
.box h2{
font-size: 1.125rem;
font-weight: 600;
text-transform: uppercase;
position: relative;
}
.box .content{
margin: 20px 0 0 0;
position: relative;
}
.box .content:before{
position: relative;
content: '';
top: -10px;
height: 20px;
width: 100%;
background: #1a1a1a;
}
.box .content:after{
position: absolute;
content: '';
height: 2px;
width: 15%;
background: #f12020;
top: -10px;
}
.left .content p{
text-align: justify;
}
.left .content .social{
margin: 20px 0 0 0;
}
.left .content .social a{
padding: 0 2px;
color: #d9d9d9;
}
.left .content .social a span{
height: 40px;
width: 40px;
background: #1a1a1a;
line-height: 40px;
text-align: center;
font-size: 18px;
border-radius: 5px;
transition: 0.3s;
}
.left .content .social a span:hover{
background: #f12020;
}
.center .content .fas{
font-size: 1.4375rem;
background: #1a1a1a;
height: 45px;
width: 45px;
line-height: 45px;
text-align: center;
border-radius: 50%;
transition: 0.3s;
cursor: pointer;
}
.center .content .fas:hover{
background: #f12020;
}
.center .content .text{
font-size: 1.0625rem;
font-weight: 500;
padding-left: 10px;
}
.center .content .phone{
margin: 15px 0;
}
.right form .text{
font-size: 1.0625rem;
margin-bottom: 2px;
color: #656565;
}
.right form .msg{
margin-top: 10px;
}
.right form input, .right form .msgForm{
width: 100%;
font-size: 1.0625rem;
background: #fff;
padding-left: 10px;
border: 1px solid #222222;
}
.right form input:focus,
.right form .msgForm:focus{
outline-color: #3498db;
}
.right form input{
height: 35px;
}
.right form .btn{
margin-top: 10px;
}
.right form .btn button{
height: 40px;
width: 100%;
border: none;
outline: none;
background: #f12020;
font-size: 1.0625rem;
font-weight: 500;
cursor: pointer;
transition: .3s;
}
.right form .btn button:hover{
background: #000;
}
.bottom center{
padding: 5px;
font-size: 0.9375rem;
background: #151515;
}
.bottom center span{
color: #656565;
}
.bottom center a{
color: #f12020;
text-decoration: none;
}
.bottom center a:hover{
text-decoration: underline;
}
#media screen and (max-width: 900px) {
footer{
position: relative;
bottom: 0px;
}
.main-content{
flex-wrap: wrap;
flex-direction: column;
}
.main-content .box{
margin: 5px 0;
}
}
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<footer>
<div class="main-content" id="contact">
<div class="left box">
<h2>About us</h2>
<div class="content">
<p>
this is the story of my life</p>
<div class="social">
<span class="fab fa-facebook-f"></span>
<span class="fab fa-twitter"></span>
<span class="fab fa-instagram"></span>
<span class="fab fa-youtube"></span>
</div>
</div>
</div>
<div class="center box">
<h2>
Address</h2>
<div class="content">
<div class="place">
<span class="fas fa-map-marker-alt"></span>
<span class="text">Birendranagar, Surkhet</span>
</div>
<div class="phone">
<span class="fas fa-phone-alt"></span>
<span class="text">+089-765432100</span>
</div>
<div class="email">
<span class="fas fa-envelope"></span>
<span class="text">abc#example.com</span>
</div>
</div>
</div>
<div class="right box">
<h2>Contact us</h2>
<div class="content">
<form action="#">
<div class="email">
<div class="text">Email *</div>
<input type="email" required>
</div>
<div class="msg">
<div class="text">Message *</div>
<textarea id=".msgForm" rows="2" cols="25" required></textarea>
</div>
<br/>
<div class="btn">
<button type="submit">Send</button>
</div>
<div class="bottom">
<center>
<span class="far fa-copyright"></span> 2020 All rights reserved.
</center>
</div>
</div>
</footer>
image of the footer
I have 3 containers for the footer. Each Container has content(more containers) in it that is all aligned at the center of the container "content". there is also h2 text which is not aligned to the rest of the content. how can i align the h2 text so that it starts the text just as my content of container"content? i tried it with text-align: center; but it's not aligned. i also tried to cut out all the single css container styles but it didn't change the position of the content from the container"content". somebody can help?
My website responsive works on my iPhone 100% but for some reason it messes up on android devices...
I've already got bootstrap integrated with it's suggested responsive string.
How it should look: http://prntscr.com/p4szot <-- iPhone
The main problem: http://prntscr.com/p4szg4 <-- Android
I've installed bootstrap and it's responsive strings.
I've added the style property word-break: break-all;
<html lang="en">
<head>
<title>Semix | Cheap Website Development</title>
<!--Font awsome---------------------------------------------------------------------------------->
<script src="https://kit.fontawesome.com/3c0298f6a8.js"></script>
<!--Google Fonts--------------------------------------------------------------------------------->
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
<!--Stylesheet----------------------------------------------------------------------------------->
<link rel=stylesheet href="style.css" type="text/css" media="screen">
<!--Bootstrap------------------------------------------------------------------------------------>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="container">
<nav>
<input type="checkbox" id="nav" class="hidden">
<label for="nav" class="nav-btn">
<i></i>
<i></i>
<i></i>
</label>
<div class="logo">
<img class="logo" src="images/logow.png">
</div>
<div class="nav-wrapper">
<ul>
<li><a class="active"href="index.html">Home</a></li>
<li>Pricing</li>
<li>faq</li>
<li>Contact</li>
</ul>
</div>
</nav>
</div>
<!--TODO Header Content-->
<div class="header">
<h1>Website development<br> made easy</h1>
<h3>Not just a business but a reliable business partner</h3>
<button type="button" class="button button-1">get started</button>
<button type="button" class="button button-2">get a quote</button>
</div>
<!-- TODO Sub Content-->
<div class="sub-content">
<h2>Professional website development</h2>
<p>Semix is a professional website & graphics development company based in South Africa, we can offer modern creative and responsive designs to best suit your needs.</p>
</div>
<!--TODO Services-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
<div class="services-section">
<div class="inner-width">
<h1 class="section-title">Our Services</h1>
<div class="border"></div>
<div class="services-container">
<div class="service-box">
<div class="service-icon">
<i class="fas fa-wrench"></i>
</div>
<div class="service-title">Technical Support</div>
<div class="service-desc">
Problem with your site? Hosting? We will help you setup your site with the correct hosting plans and domain registration
</div>
</div>
<div class="service-box">
<div class="service-icon">
<i class="fas fa-code"></i>
</div>
<div class="service-title">Web Development</div>
<div class="service-desc">
We create beautiful and functional websites with responsive designs to ensure our work looks great on any device
</div>
</div>
<div class="service-box">
<div class="service-icon">
<i class="fas fa-brush"></i>
</div>
<div class="service-title">Live chat / email</div>
<div class="service-desc">
Make sure your business never sleeps by integrating a contact form and live chat with automatic replies to your amazing site
</div>
</div>
<div class="service-box">
<div class="service-icon">
<i class="fas fa-headset"></i>
</div>
<div class="service-title">Support</div>
<div class="service-desc">
We have amazing support to make sure we can help you in any way possible
</div>
</div>
<div class="service-box">
<div class="service-icon">
<i class="fab fa-searchengin"></i>
</div>
<div class="service-title">SEO</div>
<div class="service-desc">
Search Engine Optimization, make sure your website is being discovered and displayed on Google search results
</div>
</div>
<div class="service-box">
<div class="service-icon">
<i class="fas fa-file-code"></i>
</div>
<div class="service-title">Custom Work</div>
<div class="service-desc">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Et eaque ratione rem porro, nihil.
</div>
</div>
</div>
</div>
</div>
<!--TODO button section-->
<div class="button-section">
<button type="button" class="button button-3">Start Your Project</button>
</div>
<div class="footer">
<p>© Copyright Semix 2019</p>
<div class="footer-nav">
Legal|
Terms|
FAQ|
Contact
</div>
<h2>Semix</h2> <img src="images/south-africa.png" alt="sa-logo">
</div>
</html>
body {
font-family: 'Open sans', sans-serif;
height: 100%;
margin: 0;
background: url(images/main-background-header.png);
background-position: center;
background-color: black;
background-repeat: no-repeat;
}
html{
height: 100%;
margin: 0;
padding: 0;
width: 100%,
}
*{
margin:0;
padding:0;
box-sizing: border-box;
word-break: break-all;
}
/*Header*/
.image{
background-position: center;
height: calc(100% + 700px);
width:100%;
background-repeat: no-repeat;
position: absolute;
z-index:-1;
top: -80px;
text-align: center;
}
.header > h1{
font-family: 'Open sansextra-bold', sans-serif;
text-align: center;
font-size: 60px;
text-transform: uppercase;
color: white;
}
.header > h3{
font-family: 'Open sans', sans-serif;
text-align: center;
color: #828282;
}
.header{
position:relative;
text-align:center;
color:white;
padding:10px 0px;
margin-top: 200px;
}
.button {
border: none;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 20px;
text-transform: uppercase;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
cursor: pointer;
display: inline-block;
flex-direction: column;
justify-content: center;
margin-top: 50px;
}
.button-1 {
background-color: transparent;
color: white;
border: 3px solid white;
text-align: center;
}
.button-2{
background-color: #FF4E00;
color: white;
border: 3px solid #FF4E00;
}
.button-1:hover{
background-color:white;
color: black;
border: 3px solid white;
}
/*Our Services Section*/
.services-section{
background: url(images/services.jpg);
background-size: cover;
padding: 60px 0;
}
.inner-width{
width: 100%;
max-width: 1200px;
margin: auto;
padding: 0 20px;
overflow: hidden;
}
.section-title{
text-align: center;
color: #ddd;
text-transform: uppercase;
font-size: 30px;
}
.border{
width: 160px;
height: 2px;
background: #FF4E00;
margin: 40px auto;
}
.services-container{
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.service-box{
max-width: 33.33%;
padding: 10px;
text-align: center;
color: #ddd;
cursor: pointer;
}
.service-icon{
display: inline-block;
width: 70px;
height: 70px;
border: 3px solid #FF4E00;
color: #fff;
transform: rotate(45deg);
margin-bottom: 30px;
margin-top: 16px;
transition: 0.3s linear;
}
.service-icon i{
line-height: 70px;
transform: rotate(-45deg);
font-size: 26px;
}
.service-box:hover .service-icon{
background: #FF4E00;
color: #ddd;
}
.service-title{
font-size: 18px;
text-transform: uppercase;
margin-bottom: 10px;
}
.service-desc{
font-size: 14px;
}
#media screen and (max-width:960px) {
.service-box{
max-width: 45%;
}
}
#media screen and (max-width:768px) {
.service-box{
max-width: 50%;
}
}
#media screen and (max-width:480px) {
.service-box{
max-width: 100%;
}
}
/*NEW NAV*/
nav {
padding: 8px;
display: inline;
}
.logo {
float: left;
padding: 8px;
margin-left: 16px;
margin-top: 8px;
width: 250px;
height: 70px;
}
nav ul{
float: right;
}
nav ul li {
display: inline-block;
}
nav ul li:not(:first-child) {
margin-left: 48px;
}
nav a.active{
font-weight: bold;
color: #FF4E00;
}
nav ul li:last-child {
margin-right: 24px;
}
nav ul li a {
display: inline-block;
outline: none;
color: white;
text-transform: uppercase;
text-decoration: none;
font-size: 15px;
}
#media screen and (max-width: 864px) {
.logo {
padding: 0;
width: 100px;
height: auto !important;
}
.header{
margin-top: 100px;
}
.header h1{
font-size: 20px;
}
.header h3{
font-size: 17px;
}
.nav-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
background: #fff;
opacity: 0;
transition: all 0.2s ease;
}
.nav-wrapper ul {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
}
.nav-wrapper ul li {
display: block;
float: none;
width: 100%;
text-align: right;
margin-bottom: 10px;
}
.nav-wrapper ul li:nth-child(1) a {
transition-delay: 0.2s;
}
.nav-wrapper ul li:nth-child(2) a {
transition-delay: 0.3s;
}
.nav-wrapper ul li:nth-child(3) a {
transition-delay: 0.4s;
}
.nav-wrapper ul li:nth-child(4) a {
transition-delay: 0.5s;
}
.nav-wrapper ul li:nth-child(5) a {
transition-delay: 0.6s;
}
.nav-wrapper ul li:not(:first-child) {
margin-left: 0;
}
.nav-wrapper ul li a {
padding: 10px 24px;
opacity: 0;
color: #000;
font-size: 14px;
font-weight: 600;
letter-spacing: 1.2px;
transform: translateX(-20px);
transition: all 0.2s ease;
}
.nav-btn {
position: fixed;
right: 10px;
top: 10px;
display: block;
width: 48px;
height: 48px;
cursor: pointer;
z-index: 9999;
border-radius: 50%;
}
.nav-btn i {
display: block;
width: 20px;
height: 2px;
background:white;
border-radius: 2px;
margin-left: 14px;
}
.nav-btn i:nth-child(1) {
margin-top: 16px;
}
.nav-btn i:nth-child(2) {
margin-top: 4px;
opacity: 1;
}
.nav-btn i:nth-child(3) {
margin-top: 4px;
}
}
#nav:checked + .nav-btn {
transform: rotate(45deg);
}
#nav:checked + .nav-btn i {
background: #000;
transition: transform 0.2s ease;
}
#nav:checked + .nav-btn i:nth-child(1) {
transform: translateY(6px) rotate(180deg);
}
#nav:checked + .nav-btn i:nth-child(2) {
opacity: 0;
}
#nav:checked + .nav-btn i:nth-child(3) {
transform: translateY(-6px) rotate(90deg);
}
#nav:checked ~ .nav-wrapper {
z-index: 9990;
opacity: 1;
}
#nav:checked ~ .nav-wrapper ul li a {
opacity: 1;
transform: translateX(0);
}
.hidden {
display: none;
}
.sub-content {
background: #FF4E00;
min-height: 200px;
margin-top: 90px;
text-align: center;
position: relative;
font-family: 'Open sans', sans-serif;
}
.sub-content h2{
color: white;
font-size: 30px;
padding-top: 30px;
text-transform: uppercase;
}
.sub-content p{
color: white;
padding-top: 30px;
}
.button-3 {
background-color: white;
color: black;
border: 3px solid white;
text-align: center;
justify-content: center;
}
.button-3:hover {
background-color: white;
color: black;
border: 3px solid rgb(209, 63, 0);
text-align: center;
justify-content: center;
}
.button-section{
background-color: #FF4E00;
justify-content: center;
position:relative;
text-align:center;
padding-bottom: 50px;
}
.footer{
background-color: #000;
color: white;
text-align: center;
padding-top: 50px;
padding-bottom: 50px;
}
.footer h2{
padding-top: 30px;
}
.footer-nav {
justify-content: center;
text-align: center;
padding-top: 20px;
}
.footer-nav a {
text-decoration: none;
color: white;
padding: 20px;
text-transform: uppercase;
}
#media screen and (max-width: 864px) {
.sub-content h2{
font-size: 20px;
}
}
The issue is that the <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> is in the wrong spot in your HTML.
This tag needs* to be one of the first tags inside the <head> and before the <title> tag and any CSS.
I believe this is because the meta tag is telling the browser how to interpret style properties that would come from #media queries (among other things).
Here is the spec:
https://drafts.csswg.org/css-device-adapt/#viewport-meta
This offers some good info on what the browser should do with the tag, which may lead to some inference to why it behaves the way it does.
*Need documentation to support this vs. this is how it works without breaking.
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>