I have tried many solutions, but to no avail.
I have issues mainly:
- why is there a scroll (both horizontally and vertically). it should just fit in the view-port size. i am using
height:100vh
. i have usedmeta
tag too. - why
background-size:cover
isn’t working, also giving scroll in vertical desktop view too. - at least the text shouldn’t have been cut at all. why is it so?
- List item
*{
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
#banner{
background: linear-gradient(rgba(0,0,0,0.5), #009688) , url(Barber_Shop_img/banner.jpg);
background-size: cover;
background-position: center;
height: 100vh;
}
.logo{
width: 140px;
position: absolute;
top: 4%;
left: 10%;
}
.banner-text {
text-align: center;
padding: 180px;
color: white;
}
.banner-text h1{
font-size: 130px;
font-family: 'Kaushan Script', cursive;
}
.banner-text p{
font-size: 20px;
font-style: italic;
}
.banner-btn{
margin: 70px auto 0;
}
/* the tutorial aims to make buttons using anchor tag, and on hover make the background color to white and text color to black */
/* explain position relative and position absolute in this context */
/* explain z-index of -1 and 1 in this code */
/* explain the transition: color 0.5s in this code. because code runs same withotut writing the word 'color' */
.banner-btn a{
color: white;
border: .5px solid #fff;
padding: 12px 0;
margin: 0 10px;
display: inline-block;
text-decoration: none;
width: 150px;
position: relative;
z-index: 1;
transition: color 0.5s;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Barbar Shop Website Design - Easy Tutorials</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Kaushan+Script&family=Poppins:wght@300&display=swap" rel="stylesheet">
</head>
<body>
<section id="banner">
<img class="logo" src="Barber_Shop_img/logo.png">
<div class="banner-text">
<h1>Hair Studio</h1>
<p>Style your hair to Style your personality</p>
<div class="banner-btn">
<a href="#"> <span></span>Find Out</a>
<a href="#"> <span></span>Read More</a>
</div>
</div>
</section>
</body>
</html>
3
Answers
Your background is not image and cover property is nonsense. Please update your code as below and it will work. Good luck
To make a fixed full-height background which works on all devices, use a separate
<div>
styled withposition: fixed
.For large headings you might find that
vw
units are good for setting the font size.