This question already has answers here:
Can I have multiple background images using CSS?
(8 answers)
Closed 1 year ago.
I would like to know if there is a way I can add a black layer over my Background image but have it slightly transparent so you can still see the Background image.
I am using Bootstrap 4 & below is the code I am using including CSS :)
Any help will be much appreciated. Thanks for help
<nav class="navbar navbar-expand-lg navbar-light bg-light ">
<div id="container-fluid">
<!-- <input type="checkbox" id="check" /> -->
<div>
<div><label for="check" class="chechbtn"><i id="chechbtn" class="fas fa-bars p-2"></i></label></div>
<div><a class="navbar-1" href="{{url('/')}}"><img src="{{ asset('gelecek/img/logo.png') }}" alt="Logo" /></a></div>
</div>
<div>
<div >
<div class="collapse navbar-collapse " id="navbarText">
<ul class="navbar-nav mb-4 mb-lg-0">
<li class="nav-item">
<div class="dropdown">
<button class="dropbtn"><span>FAALİYETLERİMİZ</span></button>
<div class="dropdown-content">
<ul>
<li><span>Gelecek Yürüyüşü</span></li>
<li><span>5 Dakika Sohbetleri</span></li>
</ul>
</div>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="https://geleceginbilimi.com/blog/">BLOG</a></li>
<li class="nav-item"><a class="nav-link" href="#">gelecek-uyeligi</a></li>
<li class="nav-item">
<div class="dropdown">
<button class="dropbtn"><span>HAKKIMIZDA</span></button>
<div class="dropdown-content">
<ul>
<li><span>Gelecek Vizyonu</span></li>
<li><span>Gelecek Meclisi</span></li>
<li>
<div class="dropdowndown">
<button class="dropbtn"><span>Gelecek Şurası</span></button>
<div class="dropdown-content">
<ul>
<li><span>Gelecek Daveti</span></li>
<li><span>Gelecek Akademisi</span></li>
<li><span>Gelecek medya</span></li>
<li><span>Geleceğin ajansi</span></li>
<li><span>Gelecek toplumu</span></li>
<li><span>Gelecek isleri</span></li>
<li><span> Gelecek tasavvuru</span></li>
</ul>
</div>
</div>
</li>
<li><span>Gelecek tasarimcilari</span></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
</div>
<div>
#auth
<div class="mr-2"><a type="button" href="{{ route('dashboard') }}" class="btn btn-outline">User Profile <i class="fas fa-sign-in-alt ml-2"></i></a></div>
#else
<div class="mr-2"><a type="button" href="{{ route('login') }}" class="btn btn-outline">login <i class="fas fa-sign-in-alt ml-2"></i></a></div>
#endauth
<div>Global <i class="fas fa-globe-africa ml-2"></i></div>
</div>
</div>
</div>
</nav>
<!-- Nav Bar End -->
<!-- Page Header Start -->
<div class="page-header mb-0" >
<div class="container ">
<div class="row">
<div class="col-12" style="padding: 36px;">
<h2>Gelecek Üyeliği</h2>
</div>
</div>
</div>
</div>
CSS background image
<style>
.page-header{
background-image: url(./gelecek/img/header_img.png);
}
</style>
You can use pseudo element ::after on your .page-header element. Make the .page-header position: relative so that the pseudo elements position properties will be relative to its position, then make your ::after position absolute and define the top and left properties to 0 so they line up with the page-header elements border box. The ::after pseudo element will have a height and width of 100% along with your black opaque layer using RGBA rgba(0, 0, 0, 0.5) -> black with a 0.5 opacity
.page-header {
background-image: url(https://allhdwallpapers.com/wp-content/uploads/2015/07/Sky-4.jpg);
position: relative;
}
.page-header::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0,0,0,0.5);
}
.page-header h2 {
color: white;
}
<div class="page-header mb-0">
<div class="container ">
<div class="row">
<div class="col-12" style="padding: 36px;">
<h2>Gelecek Üyeliği</h2>
</div>
</div>
</div>
</div>
You can simply use background color along with the image like this;
.page-header {
background-image: url(https://allhdwallpapers.com/wp-content/uploads/2015/07/Sky-4.jpg) rgb(163 204 170 / 50%);
}
I am using rgb(163 204 170 / 50%); with opacity, you can use color of your choice. Hope this will solve your problem.
You can learn about colors with opacity from w3Schools.
Related
I am trying to position an image to the right of the content area as shown in this dribble shot.
https://dribbble.com/shots/15571736-Money-Transfer-Website
Here is what I have so far.
https://codepen.io/pinapelkod/pen/RwLJJNm
.content {
position: relative;
}
.bg-image {
position: relative;
top: 350px;
left: 450px;
height: 350px;
z-index: 2;
}
When I float the image or position using top and left properties, the layout gets distorted.
By updating the bg-image class style I got the following result. If there is a different problem, specify it more clearly.
body {
background-color: white;
color: #1d2331;
}
.bg-image {
float: right !important;
width: 100%;
position: relative;
height: auto;
margin-right: -40% !important;
}
a.nav-link,
a.navbar-brand {
color: #1d2331;
}
a i {
color: #c9327b;
}
form .btn {
background-color: #1d2331;
color: #f3f1fe;
}
.action-call {
min-height: 35vh;
}
.feature {
background-color: #f3f1fe;
min-height: 56vh;
}
.feature .icon-link {
text-decoration: none;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<header>
<nav class="navbar navbar-expand-md mt-4">
<div class="container-fluid mx-5">
<a class="navbar-brand" href=""> <i class="bi bi-app-indicator me-2"></i> <strong>Fincy App</strong></a>
<div class="vr ms-0"></div>
<div class="dropdown">
<button class="btn dropdown-toggle" type=" button" id="personalbtn" data-bs-toggle="dropdown"
aria-expanded="false"><strong>Personal</strong></button>
</div>
<ul class="navbar-nav ms-auto">
<li class="nav-item me-4">
<a class="nav-link" href="#"><strong>Download</strong></a>
</li>
<li class="nav-item me-4"><a class="nav-link" href="#"> <strong>Plans</strong></a></li>
<li class="nav-item me-4"><a class="nav-link dropdown-toggle" href="#"> <strong>Product </strong></a>
</li>
</ul>
<form class="ms-5">
<button class="btn btn-outline-success px-5" type="submit">Login</button>
</form>
</div>
</nav>
</header>
<article class="content">
<img class="bg-image" src="https://pinapelkod.github.io/assets/imgs/03_1.svg" alt="">
<section class="mx-5 action-call d-flex align-items-center ">
<div class="container-fluid">
<div class="row t-row">
<h1> <strong>Send money <br>abroad more faster</strong></h1>
<div class="sendnow"></div>
</div>
</div>
</section>
<section class="feature d-flex align-items-center">
<div class="container-fluid">
<div class="mx-5 row b-row">
<div class="d-flex justify-content-start">
<div class="col-3 me-3">
<i class="fs-2 bi bi-shield-shaded"></i>
<h5> <strong>Safety guarantee</strong></h5>
<p>We make sure your money will <br>be safe 100% guarantee</p>
<a href="#" class="icon-link"> <strong>Read more</strong><i class="bi bi-chevron-right text-primary"></i>
</a>
</div>
<div class="col-3 me-3">
<i class="fs-2 bi bi-credit-card-2-front-fill"></i>
<h5> <strong>Send money in minutes</strong></h5>
<p>Your money will be sent faster <br>than your blue wallet</p>
<a href="#" class="icon-link"> <strong>Send money now</strong><i
class="bi bi-chevron-right text-primary"></i> </a>
</div>
</div>
</div>
</div>
</section>
</article>
<img style="float: right;" alt="" src="http://example.com/image.png" />
<div style="clear: right">
...text...
</div>
I restructured the html and added a bootstrap display (d-flex) class as shown below.
Update HTML structure:
<div class="d-flex mt-5">
<div class="col-3 ">
.....
</div>
<div class="col-3">
.....
</div>
<div class="col-6 content">
<img class="bg-image" src="https://pinapelkod.github.io/assets/imgs/03_1.svg" alt="">
</div>
</div>
The corresponding CSS:
.content {
position: relative;
}
.bg-image {
position: relative;
top: -310px;
left: 160px;
height: 500px;
}
Link to codepen:
https://codepen.io/pinapelkod/pen/RwLJJNm
I have attempted to place elements below the navigation bar I created, however, it keeps distorting the NavBar. I have used bootstrap so I was hoping I could add a form underneath the code below, it's honestly just an issue of spacing and I have read the bootstrap documentation yet I still find it difficult. The code below is fine but could someone try to add a form or some kind of input box below it, please. Thank you, guys.
<! this is where the nav bar starts to be made>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar-fixed-top">
<!this is the length and theme of the navigation bar is set>
<ul class="navbar-nav pl-2">
<! i've added padding left as i need to space out items in the nav bar well>
<li class="nav-item">
District 1
</li>
<! the home button is the name of the store>
<div class="mx-auto">
<form class="mx-auto order-0 col px-md-5">
<! this is the creation of the search bar>
<div class="mx-auto input-group mt-1">
<div class="input-group-prepend" style="margin-left: 380px; margin-top: 5px;">
<button class="btn btn-outline-secondary" type="button" id="button-addon1"><img
src="https://img.icons8.com/pastel-glyph/2x/search--v2.png" alt="Search" class="mx-auto"
width="20" height="20"></button>
<! this is the image for the search button function>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Example text with button addon"
aria-describedby="button-addon1" style="margin-top: 5px;">
</form>
</div>
</ul>
<ul class="navbar-nav ml-auto ">
<li class="nav-item" style="padding-right: 120px;">
<a id="one" href="SignIn.php" class="nav-link" style="font-size: 15px;">Hello, <br> Sign in!</a>
</li>
<! this is the sign in button>
<li class="nav-item mr-5">
<a id="two" href="SignIn.php" class="nav-link"><img
src="https://img.icons8.com/pastel-glyph/2x/shopping-cart--v2.png" alt="Cart" width="40"
height="40"></a>
</li>
<! this is the shopping cart button>
</li>
</ul>
Here are examples of input fields and forms below your nav, is this what you are looking for?
Please see comments in the code to understand better.
Comment if you have more questions.
.flex-c-row {
display:flex;
align-items:center;
margin:25px;
} /* setting the display to flex, which is by default 'row' with items side-by-side; give it align-items:center to align items vertically in the available space */
.flex-c-row > * {
margin:50px; /* space all direct child elements of the outer container by 50px on all sides top bottom right left */
}
.flex-c-col, form {
display:flex;flex-direction:column; /* same as above but set the flexbox direction of elements as a COLUMN so vertical */
}
input {
cursor:pointer;
}
form > * {
margin:25px 0;
}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar-fixed-top">
<ul class="navbar-nav pl-2">
<li class="nav-item">
District 1
</li>
<div class="mx-auto">
<form class="mx-auto order-0 col px-md-5">
<div class="mx-auto input-group mt-1">
<div class="input-group-prepend" style="margin-left: 380px; margin-top: 5px;">
<button class="btn btn-outline-secondary" type="button" id="button-addon1"><img
src="https://img.icons8.com/pastel-glyph/2x/search--v2.png" alt="Search" class="mx-auto"
width="20" height="20"></button>
</div>
<input type="text" class="form-control" placeholder="" aria-label="Example text with button addon"
aria-describedby="button-addon1" style="margin-top: 5px;">
</div>
</form>
</ul>
<ul class="navbar-nav ml-auto ">
<li class="nav-item" style="padding-right: 120px;">
<a id="one" href="SignIn.php" class="nav-link" style="font-size: 15px;">Hello, <br> Sign in!</a>
</li>
<li class="nav-item mr-5">
<a id="two" href="SignIn.php" class="nav-link"><img
src="https://img.icons8.com/pastel-glyph/2x/shopping-cart--v2.png" alt="Cart" width="40"
height="40"></a>
</li>
</ul>
</nav>
<!-- so here we simply add the container div for our 3 input examples -->
<div class="flex-c-row">
<div class="flex-c-col">
<span>This is an input field</span>
<input type="datetime-local">
</div>
<div class="">
<form>
<h3>This is a basic form.</h3>
<input>
<input>
<textarea cols="15" rows="25"></textarea>
</div>
<div class="flex-c-col">
<span>This is a color input field.</span>
<input type="color">
</div>
<div>
Codepen to play with:
https://codepen.io/larrytherabbit/pen/pobjKLw
my html page has this unwanted white patch in the bottom and I don't know why. I don't want to be able to scroll down that long. It stays there regardless by default. it dissapears when I hover on the left(front) element but reappears when I hover on the right(behind) element.
here is the codepen : https://codepen.io/aronnora/pen/ExjJrag
<nav class="nav_bar">
<img src="580b57fcd9996e24bc43c4f8.png" alt="logo" class="logo" id="logo">
<div class="trans" id="trans"> trans energy solutions </div>
<ul class="ul">
<li class="li1">Home</li>
<li class="li2">About Us</li>
<li class="li3">Products</li>
<li class="li4">Services</li>
<li class="li5">Facility</li>
<li class="li6">Testing</li>
<li class="li7">Clients</li>
<li class="li8">Contact</li>
</ul>
</nav>
<div class="white">
</div>
<div class="pro">
<div class="text">
PRODUCTS
</div>
</div>
<div class="total">
<div class="one">
<img src="liquid-immersed-distribution-transformers-768x784.png" alt="kakashi" class="Kakashi" height="300rem"></img>
<div class="downtextone">
時メユ郎護ヲテ写藤くクッル起稲ロチ製資ヌ米更ナ池天ワア由時テ栃94探容ケニ災逮はぴ氷可難智む。能ざラくな静盟ごぼじ不注更ルモト点究サトケ別意マワ抜博写ミ元
</div>
</div>
<div class="two">
<img src="transtech-2.png" alt="madara" class="Madara" height="300rem"></img>
<div class="downtexttwo">
時メユ郎護ヲテ写藤くクッル起稲ロチ製資ヌ米更ナ池天ワア由時テ栃94探容ケニ災逮はぴ氷可難智む。能ざラくな静盟ごぼじ不
</div>
</div>
</div>
your div takes a default height as it's content. so just add overflow:hidden; to class (.tow)
.two {
height: 58.29rem;
width: 45rem;
transition: opacity 1s;
background-color: black;
position: absolute;
z-index: 10;
overflow: hidden;
}
I've a footer that is divided in 2 columns, 1 to the left and 1 to the right.
But I'd like to set the margins so the content of the footer is align with the body (with the images you see there).
I've used Bootstrap4 tags (container) for the body but it is not working for the footer.
I'm expecting to replicate this:
Codepen
https://codepen.io/anon/pen/vwMowX
footer:
<!-- /* NEW FOOTER */ -->
{% load staticfiles %}
<style>
ul > li {
display: inline-block;
/* You can also add some margins here to make it look prettier */
zoom:1;
*display:inline;
/* this fix is needed for IE7- */
}
</style>
<div class="container-fluid">
<div id="footer-navbar" class="row footer navbar-fixed-bottom padding-top2 padding-bottom2">
<div class="col-md-6">
<div class="">
<nav class="">
<div class="mx-auto d-sm-flex d-block flex-sm-nowrap">
<ul class="">
<li class="">
<a class="" href="{% url 'shop:quienes_somos' %}">¿Quiénes somos?</a>
</li>
<li class="">
<a class="" href="{% url 'shop:como_comprar' %}">¿Cómo comprar?</a>
</li>
<li class="">
<a class="" href="{% url 'shop:contactanos' %}">Contáctanos</a>
</li>
</ul>
</div>
</nav>
<ul class="left footer-links footer-interact hidden-md-down">
<li><i class="fab fa-twitter"></i></i></li>
<li><i class="fab fa-instagram"></i></i></li>
<li><i class="fab fa-facebook-square"></i></i></li>
<li><i class="fab fa-youtube"></i></i></li>
</ul>
</div>
</div>
<div class="col-md-6 text-right">
<div class="">
<p><img src="{% static 'img/home/peru-flag.png' %}"
width="40px" height="40px">Perú</p>
</div>
<div class="right footer-legal">
<span>© 2019 StickersGallito</span>
Privacy & Terms
</div>
</div>
</div>
</div>
UPDATE 1
adding the container-fluid div and container div don't allow the background to go full width.
This works for me:
https://codepen.io/anon/pen/jooNYJ#anon-login
All changes I've done are in the first 2 divs
They should look like:
<div id="footer-navbar">
<div class="container row footer navbar-fixed-bottom padding-top2 my-0 mx-auto padding-bottom2">
***content***
</div>
</div>
The class container-fluid sets width to 100%, container doesn't. You need to have an inner wrapping div with the container class.
<div class="container-fluid">
<div class="container">
*** Put your footer in here ***
</div>
</div>
The inner div will be centered.
So I have this navbar made with materialize
My code is:
<nav class="light-blue lighten-1 " role="navigation">
<div class="nav-wrapper container "><a id="logo-container" href="#" class="brand-logo">Treasure Hunt</a>
<ul id="navbarUl" class="right hide-on-med-and-down">
<li class="active">Misiuni</li>
<li>NewsFeed</li>
<li>Clasament</li>
<li> </li>
<li id="navbarLi">
<div class="row">
<div class="col s6"><a id="navbarImg" href="#"><img src="img/asd.jpg" class="circle responsive-img small"/></a></div>
<div class="col s6">Adyzds</div>
</div>
</li>
<li >
<div class="row">
<div class="col s4">Level:
<span>Value</span>
</div>
<div class="col s4">XP:
<span>Value</span>
</div>
</div>
</li>
</ul>
</div>
</nav>
My mouse is over the profile pic. I would like the hover effect to cover the name too. Also, I would like the Level value to be near Level.
Can anyone help me?
CSS:
.icon-block {
padding: 0 15px;
}
.icon-block .material-icons {
font-size: inherit;
}
#navbarImg{
padding-top: 10px;
max-width: 70px;
max-height: 64px;
}
#navbarLi{
max-height: 64px;
}
Your columns are too narrow for Level: + value. Instead of creating a row with 2 columns inside, try using seperate <li> for each:
<li >
Level: <span>7</span>
</li>
<li>
XP:<span>105</span>
</li>
As for your name, just nest it in a <a> element and materialize will know what to do with it.
Check out this fiddle: https://jsfiddle.net/pwxa6e80/3/ ... hope it helps :)