List Items not changing on hover - html

Using Bootstrap 4, I'm having difficulty targetting the list items on hover. I'm trying to have a default color of the text to a gray, but on hover, make the text a regular black, and on active, have the text white, bolded, with a background color for the different states of the list items.
Here's what it looks like now:
Here is my HTML:
<div class="container mt-5">
<div class="row">
<div class="col-sm-4">
<div class="card">
<div class="card-header">
<h4 class="card-title">
<img src="resources/icons/icon-monster/iconmonstr-gear-11-48.png" alt="" class="mr-2">
Account Settings
</h4>
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item active">About You</li>
<li class="list-group-item">Education and background</li>
<li class="list-group-item">Professional Development</li>
<li class="list-group-item">Password</li>
<li class="list-group-item">Email/Notifications</li>
<li class="list-group-item">Reviews</li>
<li class="list-group-item">Privacy Settings</li>
</ul>
</div>
</div>
</div><!--end of col-sm-4-->
Here is my CSS:
/*----------------------------------------*/
/*--------SIDEBAR ACCOUNT SETTINGS---------*/
/*-----------------------------------------*/
.list-group-item.active {
background-color: #328cc1;
border-color: #328cc1;
font-weight: bold;
color: #fff;
}
.list-group-item {
color: gray;
}
.list-group-item: hover {
color: black;
}
Everything works great except the list item isn't capturing the change on hover. I've tried targetting it by ul li .list-group-item: hover and that doesn't work either.

There's a space between : and hover. That was the problem with it.
.list-group-item.active {
background-color: #328cc1;
border-color: #328cc1;
font-weight: bold;
color: #fff;
}
.list-group-item {
color: gray;
}
.list-group-item:hover {
color: black;
}
<div class="container mt-5">
<div class="row">
<div class="col-sm-4">
<div class="card">
<div class="card-header">
<h4 class="card-title">
<img src="resources/icons/icon-monster/iconmonstr-gear-11-48.png" alt="" class="mr-2"> Account Settings
</h4>
</div>
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item active">About You</li>
<li class="list-group-item">Education and background</li>
<li class="list-group-item">Professional Development</li>
<li class="list-group-item">Password</li>
<li class="list-group-item">Email/Notifications</li>
<li class="list-group-item">Reviews</li>
<li class="list-group-item">Privacy Settings</li>
</ul>
</div>
</div>
</div>
<!--end of col-sm-4-->

Related

Footer layout, responsiveness and hiding on small devices with Bootstrap 4

New to Bootstrap 4 here. I'm trying to get my page footer to conform to the same layout as the following mockup:
My best attempt thus far is as follows:
index.html (snippet):
<!-- footer -->
<hr/>
<div class="container-fluid">
<div class="row">
<div class="col-sm">
<span class="linklist-label">Foobar</span>
<ul class="linklist">
<li><a class="footer-link" href="">Fizz</a></li>
<li><a class="footer-link" href="">Buzz</a></li>
<li><a class="footer-link" href="">Foobar</a></li>
</ul>
</div>
<div class="col-sm">
<span class="linklist-label">Other Stuff</span>
<ul class="linklist">
<li><a class="footer-link" href="">Cool Links</a></li>
<li><a class="footer-link" href="">What's New</a></li>
<li><a class="footer-link" href="">Newsletter</a></li>
</ul>
</div>
<div class="col-sm">
<span class="linklist-label">Zoo Stuff</span>
<ul class="linklist">
<li><a class="footer-link" href="">Zebras</a></li>
<li><a class="footer-link" href="">Rhinos</a></li>
<li><a class="footer-link" href="">Monkeys</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-6">
<img src="dummy-logo.png" class="img-fluid footer-logo" alt="My logo">
</div>
<div class="col-sm">
<span class="linklist-label">Contact Us</span>
<br/><span class="fas fa-phone" aria-hidden="true"></span> 800.555.5555
<br/><span class="fas fa-envelope" aria-hidden="true"></span> info#example.com
<br/><span class="fas fa-map-marker-alt" aria-hidden="true"></span> 123 Testville Rd
<br/> Testville, XY 12345
</div>
</div>
</div>
<div class="row">
<div class="col-sm">Status</div>
<div class="col-sm">Legal</div>
<div class="col-sm">Privacy</div>
<div class="col-sm">Terms</div>
</div>
main.css:
html, body {
height: 100%;
font-family: 'Lato';
}
.bordered {
border-radius: 5px;
border: 1px solid white;
}
.navbar {
background-color: #00142E;
}
#navb ul {
align-items: center;
}
.red-button {
border-radius: 5px;
border: 1px solid #A81E30;
background-color: #A81E30;
color: beige;
}
.mainlogo {
height: 50px;
}
.footer-logo {
height: 100px;
}
hr {
margin-top: 1rem;
margin-bottom: 1rem;
border: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.linklist {
list-style-type: none;
padding-left: 0;
}
.linklist-label {
font-weight: bolder;
color: #A81E30;
}
.linklist a.footer-link {
color: #00142E;
}
.linklist a.footer-link:hover {
color: gray;
}
When this runs in the browser, I get:
As you can see, I'm kinda sorta somewhat there, but still have a ways to go. As far as responsiveness goes, I think that if the screen is small (mobile device, etc.) I want the footer (everything here) to disappear entirely.
Can anyone spot where my layout/positioning is going awry and also help me achieve the "disappear on small screen" functionality I'm looking for?
.mainlogo {
height: 50px;
}
.footer-logo {
height: 100px;
}
hr {
margin-top: 1rem;
margin-bottom: 1rem;
border: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.linklist {
list-style-type: none;
padding-left: 0;
}
.linklist-label {
font-weight: bolder;
color: #A81E30;
}
.linklist a.footer-link {
color: #00142E;
}
.linklist a.footer-link:hover {
color: gray;
}
#myLogo {
width: 360px;
height: 58px;
border: 1px solid red;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<hr>
<div class="container-fluid d-none d-sm-block">
<div class="row">
<div class="col-sm-8">
<div class="row">
<div class="col-sm-6">
<span class="linklist-label">Foobar</span>
<ul class="linklist">
<li><a class="footer-link" href="">Fizz</a></li>
<li><a class="footer-link" href="">Buzz</a></li>
<li><a class="footer-link" href="">Foobar</a></li>
</ul>
</div>
<div class="col-sm-6">
<span class="linklist-label">Other Stuff</span>
<ul class="linklist">
<li><a class="footer-link" href="">Cool Links</a></li>
<li><a class="footer-link" href="">What's New</a></li>
<li><a class="footer-link" href="">Newsletter</a></li>
</ul>
</div>
<div class="col-sm-12">
<img src="dummy-logo.png" class="img-fluid footer-logo" alt="My logo" id="myLogo">
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">Status</div>
<div class="col-sm-3">Legal</div>
<div class="col-sm-3">Privacy</div>
<div class="col-sm-3">Terms</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<span class="linklist-label">Zoo Stuff</span>
<ul class="linklist">
<li><a class="footer-link" href="">Zebras</a></li>
<li><a class="footer-link" href="">Rhinos</a></li>
<li><a class="footer-link" href="">Monkeys</a></li>
</ul>
<span class="linklist-label">Contact Us</span>
<br/><span class="fas fa-phone" aria-hidden="true"></span> 800.555.5555
<br/><span class="fas fa-envelope" aria-hidden="true"></span> info#example.com
<br/><span class="fas fa-map-marker-alt" aria-hidden="true"></span> 123 Testville Rd
<br/> Testville, XY 12345
</div>
</div>
</div>
For making your footer disappear for certain device you need to mentioned maximum and minimum size of screen where you want to display.
#media only screen and (max-width: 767px) and (min-width: 480px) {
.footer{ display: none !important;}
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<footer class="d-none d-sm-block">
<div class="container-fluid">
<div class="row my-2">
<div class="col-4">
<div class="footer-col py-5 bg-success">
<p class="text-white text-center">Title & list items</p>
</div>
</div>
<div class="col-4">
<div class="footer-col py-5 bg-success">
<p class="text-white text-center">Title & list items</p>
</div>
</div>
<div class="col-4">
<div class="footer-col py-5 bg-success">
<p class="text-white text-center">Title & list items</p>
</div>
</div>
</div>
<div class="row my-3">
<div class="col-8">
<div class="footer-col">
<figure class="py-5 bg-info">
<p class="text-white text-center">The image</p>
</figure>
<ul class="nav justify-content-around py-1 bg-primary">
<p class="text-white text-center">Footer nav</p>
</ul>
</div>
</div>
<div class="col-4">
<div class="footer-col py-5 bg-success">
<p class="text-white text-center">Title & list items</p>
</div>
</div>
</div>
</div>
</footer>
You can nest row and columns like this:
html, body {
height: 100%;
font-family: 'Lato';
}
.bordered {
border-radius: 5px;
border: 1px solid white;
}
.navbar {
background-color: #00142E;
}
#navb ul {
align-items: center;
}
.red-button {
border-radius: 5px;
border: 1px solid #A81E30;
background-color: #A81E30;
color: beige;
}
.mainlogo {
height: 50px;
}
.footer-logo {
height: 100px;
}
hr {
margin-top: 1rem;
margin-bottom: 1rem;
border: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.linklist {
list-style-type: none;
padding-left: 0;
}
.linklist-label {
font-weight: bolder;
color: #A81E30;
}
.linklist a.footer-link {
color: #00142E;
}
.linklist a.footer-link:hover {
color: gray;
}
#myLogo { display: block; width: 360px; height: 58px; border: 1px solid red; margin: 1em auto;}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<hr>
<div class="container-fluid d-none d-sm-block">
<div class="row">
<div class="col-sm-8">
<div class="row">
<div class="col-sm-6">
<span class="linklist-label">Foobar</span>
<ul class="linklist">
<li><a class="footer-link" href="">Fizz</a></li>
<li><a class="footer-link" href="">Buzz</a></li>
<li><a class="footer-link" href="">Foobar</a></li>
</ul>
</div>
<div class="col-sm-6">
<span class="linklist-label">Other Stuff</span>
<ul class="linklist">
<li><a class="footer-link" href="">Cool Links</a></li>
<li><a class="footer-link" href="">What's New</a></li>
<li><a class="footer-link" href="">Newsletter</a></li>
</ul>
</div>
<div class="col-sm-12">
<img src="dummy-logo.png" class="img-fluid footer-logo" alt="My logo" id="myLogo">
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">Status</div>
<div class="col-sm-3">Legal</div>
<div class="col-sm-3">Privacy</div>
<div class="col-sm-3">Terms</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<span class="linklist-label">Zoo Stuff</span>
<ul class="linklist">
<li><a class="footer-link" href="">Zebras</a></li>
<li><a class="footer-link" href="">Rhinos</a></li>
<li><a class="footer-link" href="">Monkeys</a></li>
</ul>
<span class="linklist-label">Contact Us</span>
<br/><span class="fas fa-phone" aria-hidden="true"></span> 800.555.5555
<br/><span class="fas fa-envelope" aria-hidden="true"></span> info#example.com
<br/><span class="fas fa-map-marker-alt" aria-hidden="true"></span> 123 Testville Rd
<br/> Testville, XY 12345
</div>
</div>
</div>
Notes::
This markup completely fit for both bootstrap 3x and 4x (haven't tried 5).
Read more on grid system here: boots4, boots3 .
The only different is the class combination d-none.d-sm-block that replace hidden-xs of bootstrap 3: This class(es) would hide the element on small devices based on framework #media rules.
Read more about helper classes for display content here.

Place div side by side

My HTML code is like below
<div class="col-lg-4">
<ul>
<div class="area" id="div_1">
<li class="category" id="1">Hair</li>
</div>
<div class="area" id="div_3">
<li class="category" id="3">Skin Care</li>
</div>
<div class="area" id="div_4">
<li class="category" id="4">Makeup</li>
</div>
<div class="area" id="div_5">
<li class="category" id="5">Body Treatments</li>
</div>
<div class="area" id="div_6">
<li class="category" id="6">Sports Massage</li>
</div>
<div class="area" id="div_7">
<li class="category" id="7">Physiotherapy</li>
</div>
<div class="area" id="div_8">
<li class="category" id="8">Intensive Healing Pedicure</li>
</div>
<div class="area" id="div_9">
<li class="category" id="9">Pedicure Refresher</li>
</div>
<div class="area" id="div_10">
<li class="category" id="10">Therapeutic Pedicure</li>
</div>
</ul>
</div>
My CSS code is like below
.col-lg-4 > ul {
overflow-x: scroll;
width: 100%;
display:flex;
}
.category {
border:0;
padding: 0;
margin-right: 30px;
font-size: 15px;
}
I would like to put div side by side with full width of their content and some margin right side.
I am getting output like below
I need output text will be in one line.
"I need output text will be in one line." Here's everything in one line. Basically, all you needed was white-space: nowrap. I removed the extra HTML of the divs wrapping each li since that was invalid HTML and wasn't necessary. If you need divs, put them inside the lis. I'd make them spans though.
.col-lg-4>ul {
overflow-x: scroll;
width: 100%;
display: flex;
}
.category {
border: 0;
padding: 0;
margin-right: 30px;
font-size: 15px;
display: inline-block;
white-space: nowrap;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" />
<div class="col-lg-4">
<ul>
<li class="category" id="1">Hair</li>
<li class="category" id="3">Skin Care</li>
<li class="category" id="4">Makeup</li>
<li class="category" id="5">Body Treatments</li>
<li class="category" id="6">Sports Massage</li>
<li class="category" id="7">Physiotherapy</li>
<li class="category" id="8">Intensive Healing Pedicure</li>
<li class="category" id="9">Pedicure Refresher</li>
<li class="category" id="10">Therapeutic Pedicure</li>
</ul>
</div>
In a grid layout, content must be placed inside columns (.col and .col-*) and only columns may be the immediate children of rows (.row). Rows should be placed inside a .container or .container-fluid for proper padding and alignment.
<div class="container">
<!--Row with two equal columns-->
<div class="row">
<div class="col-md-6">Column left</div>
<div class="col-md-6">Column right</div>
</div>
</div>
The width of col-lg-4 is only 25% of the page. The text is getting cramped because of this. You can change it to col-lg-12 to occupy the whole page.
.col-lg-12>ul {
overflow-x: scroll;
width: 100%;
display: flex;
}
.category {
border: 0;
padding: 0;
margin-right: 30px;
font-size: 15px;
}
try this instead,
First of all remove all div inside the ,
Then,add this style,
.col-lg-4 > ul {
overflow-x: scroll;
white-space:nowrap;
margin:0;
}
.category {
margin-right: 30px;
font-size: 15px;
display:inline-block;
}
white-space:nowrap makes the inline. More info about white-space
All <li> makes inline by display:inline-bock. More info about display
.col-lg-4 > ul {
overflow-x: scroll;
white-space:nowrap;
margin:0;
}
.category {
margin-right: 30px;
font-size: 15px;
display:inline-block;
}
<div class="col-lg-4">
<ul>
<li class="category" id="1">Hair</li>
<li class="category" id="3">Skin Care</li>
<li class="category" id="4">Makeup</li>
<li class="category" id="5">Body Treatments</li>
<li class="category" id="6">Sports Massage</li>
<li class="category" id="7">Physiotherapy</li>
<li class="category" id="8">Intensive Healing Pedicure</li>
<li class="category" id="9">Pedicure Refresher</li>
<li class="category" id="10">Therapeutic Pedicure</li>
</ul>
</div>

How to remove bg color of ul

I want to remove background color ul list but not getting removed.
This is my code
<div style="margin-left: 15px; margin-top: 20px;" class="col-md-8 card card-body bg-light">
<div class="row">
<div class="col-md-8">
<div id="mydiv2">
</div>
</div>
<div class="col-md-4">
<div style="border: none;margin-left: 10px; margin-top: 25px;">
<ul style="background-color: transparent;" class="list-group .list-group-flush borderless">
<li style="border: transparent; height: 47px;" class="list-group-item d-flex justify-content-between align-items-center">
Item 1
<span class="badge badge-primary badge-pill">14</span>
</li>
<li style="border: none; height: 47px;" class="list-group-item borderless ">Item 2</li>
<li style="border: none; height: 47px;" class="list-group-item borderless">Item 3</li>
</ul>
</div>
</div>
</div>
<style>
.ul {
background-color:transparent;
}
</style>
This is my output
ul is the tag name not class.
you can either
select them with their class names: .list-group{}
or just ul{}.
also remove the "." from in html class names class=".list-group-flush".
If its still not applying try making the css selector more specific so it can override bootstrap. or add !important (not recomended)
<style>
ul.list-group{
background-color: transparent;
}
</style>

Menu going down together with scrolling the page

I have this code:
.navbar-default .navbar-nav>li>a {
width: auto;
/* width: 200px;*/
/* font-weight: bold;*/
}
.mega-dropdown {
position: static !important;
/* width: 100%;*/
}
.mega-dropdown-menu {
padding: 0px;
width: 100%;
box-shadow: none;
-webkit-box-shadow: none;
}
.mega-dropdown-menu > li > ul {
padding: 0;
margin: 0;
}
.mega-dropdown-menu > li > ul > li {
list-style: none;
}
.mega-dropdown-menu > li > ul > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 300;
line-height: 1.428571429;
color: #243C78;
white-space: normal;
}
.mega-dropdown-menu .dropdown-header {
color: #243C78;
font-size: 18px;
font-weight: 500;
}
.mega-dropdown-menu form {
margin: 3px 20px;
}
.mega-dropdown-menu .form-group {
margin-bottom: 3px;
}
<section class="indexTop">
<div class="container">
<div class="row indexTopPadding">
<div class="col-xs-8 col-sm-12 col-md-12 col-lg-11 ">
<div class="topData">Poniedziałek, 11 października 2019</div>
</div>
<div class="col-xs-4 col-sm-12 col-md-12 col-lg-1">
<div class="topKontrast">
<img src="images/ikon2.png" class="img-responsive topIkonLeft topIkonLeft5">
<img src="images/ikon1.png" class="img-responsive topIkonLeft topIkonLeft5">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 topMargin15 visible-xs">
<div class="topSocialMedia">
<img src="images/ikon7.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon3.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon4.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon5.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
<img src="images/ikon6.png" class="img-responsive topIkonLeft topIkonLeft10 ikonSocialMediaR">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-5 topMargin30R ">
<div class="logo">
<img src="images/logo.png" class="img-responsive ikonCenterR">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-4 topMargin10 hidden-xs">
<form method="post" name="contactformXX" class="form validate clearfix validate-form">
<div class="form-group ">
<div class="form-group has-feedback ">
<input type="text" class="form-control indexInputSzukaj" id="inputValidation" placeholder="Znajdź" /> <span class="glyphicon glyphicon-search form-control-feedback glyphiconColor"></span> </div>
</div>
</form>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 topMargin15 hidden-xs">
<div class="topSocialMedia">
<img src="images/ikon7.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon3.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon4.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon5.png" class="img-responsive topIkonLeft topIkonLeft10">
<img src="images/ikon6.png" class="img-responsive topIkonLeft topIkonLeft10">
</div>
</div>
</div>
</div>
</section>
<!-- END TOP-->
<!-- MENU-->
<div class="paddingMenuTop"></div>
<nav class="navbar navbar-default navbarDefaultMop ">
<div class="container">
<!-- navbar-fixed-top -->
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".js-navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand visible-xs" href="#">MegaMenu</a></div>
<div class="collapse navbar-collapse js-navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown mega-dropdown menuMop"> Item xxx1
<ul class="dropdown-menu mega-dropdown-menu row dropdownMenuMop">
<div class="container topMenuColor">
<li class="col-sm-3">
<ul class="hideBullet">
<li class="dropdown-header hideBullet">Sprawy </li>
<li>pozycja 1</li>
<li>pozycja 2</li>
<li>pozycja 3</li>
<li>pozycja 4</li>
<li>pozycja 5</li>
<li class="dividerMop"></li>
<li class="dropdown-header hideBullet">pozycje 5</li>
<li>Bezpłatana imnformaja</li>
<li>dream</li>
<li>Callendar</li>
<li>Archiwum Mewspow</li>
</ul>
</li>
<li class="col-sm-3">
<ul class="hideBullet">
<li class="dropdown-header hideBullet">My life </li>
<li>Health</li>
<li>Bicycles</li>
<li>Cars</li>
<li>Education</li>
<li>Cash</li>
<li class="dividerMop"></li>
<li class="dropdown-header hideBullet">Fundation</li>
<li>xdcsdcsd cdscdscds</li>
<li>Magazine</li>
<li>Items</li>
<li>Items2</li>
</ul>
</li>
<li class="col-sm-3">
<ul class="hideBullet">
<li class="dropdown-header hideBullet">My life </li>
<li>Health</li>
<li>Bicycles</li>
<li>Cars</li>
<li>Education</li>
<li>Cash</li>
<li class="dividerMop"></li>
<li class="dropdown-header hideBullet">Fundation</li>
<li>xdcsdcsd cdscdscds</li>
<li>Magazine</li>
<li>Items</li>
<li>Items2</li>
</ul>
</li>
<li class="col-sm-3">
<ul>
<li class="dropdown-header">Accessories</li>
<li>Default Navbar</li>
<li>Lovely Fonts</li>
<li>Responsive Dropdown </li>
<li class="dividerMop"></li>
<li class="dropdown-header">Newsletter</li>
<form class="form" role="form">
<div class="form-group">
<label class="sr-only" for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email"> </div>
<button type="submit" class="btn btn-primary btn-block">Sign in</button>
</form>
<li class="dropdown-header">zamknij mnie2
<button type="button" class="close">×</button>
</li>
</ul>
</li>
</div>
</ul>
</li>
</ul>
</div>
<!-- /.nav-collapse -->
</div>
</nav>
I have a problem with the menu (NAVBAR).
I would like it to descend with scrolling the page down (stuck to the top of the browser).
The effect that I would like to get is here: https://www.gdynia.pl
Dla mieszkańców, aktualności, dla turystów, o Gdyni,
Does anyone know how to improve my code to get this effect?
Prview: http://serwer1356363.home.pl/pub/menu_fixed/
You can add to .navbar some other class with style like this: position: fixed; top:0; and replace position:relative with position:fixed;.
- Add this class only after you scroll down some pixels.
- If you not scrolled some pixels use remove or don't add class.
- Use Javascript or JQuery to detect how many user already scrolled pixels and also to add or remove element class.
I think everything is clear here. I just opened your site and used chrome dev tools to see applied effects. Just play with code and styles. After apply changes in real code.
You can look more here: set div position to fixed after scrolling 100px?

Materialize nav bar issue

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 :)