Skip to main content
Inspiring
December 19, 2022
Question

Submenu leaving pixels in desktop view

  • December 19, 2022
  • 1 reply
  • 651 views

I came up with a template design that I like. Everything works well with no errors, except for one detail. The drop down menu in desktop mode leaves a residue of text for a second or so, before fading off. 

 

Here is the code that affects that area:

 

.nav-menu li:hover>.sub-menu{

top: 4rem;

opacity: 1;

visibility: visible;

}

 

.sub-menu li:hover>.sub-menu{

top: 0rem;

left: 8rem;

}

 

At first I tried using a no hover class after the hover class:

 

.nav-menu li:not(:hover)> .sub-menu{

display:none;

}

That fixed the problem in mobile view but not desktop view. It eliminated the residue but rendered the sub menu unusable, because it disappeared too fast. I also tried experimenting with transition properties. That made it worse. Is there any easy fix?  Here is the page:  

https://atnuke.com/idx-1.html

[Link edited by moderator for clarity.]

 

Thanks again.

 

This topic has been closed for replies.

1 reply

BenPleysier
Community Expert
Community Expert
December 20, 2022

Add `opacity: 0;` to the sub-menu as in 

 

 

 

.sub-menu {
	line-height: 2rem;
	width: -webkit-max-content;
	width: -moz-max-content;
	width: max-content;
	padding-left: 5px;
	padding-right: 5px;
	display: block;
	position: absolute;
	border-top: 3px solid #145DDD;
	background-color: #191919;
	-webkit-transition: all 650ms ease;
	transition: all 650ms ease;
	top: 4rem;
	visibility: hidden;
	z-index: 1000;
    opacity: 0;
}

 

 

 

Off Topic: Your CSS is a complete mess! First, you need to start with the smallest screen size first. Make sure everything looks the way that you want it to. Then fiddle with media queries and override only those style rules that affect the next size up. .nav-menu li:hover>.sub-menu{ top: 4rem; opacity: 1; visibility: visible; } .sub-menu li:hover>.sub-menu{ top: 0rem; left: 8rem; }

 

Either, properly structure the style sheet or have specific style sheets per component. The latter is ceratinly true if serving HTTP/2 or higher.

 

A time saving solution is to use Bootstrap. I know, I know, you want to do it yourself and that is to be respected. But I think that your time could be spent more productively than sitting behind that screen. Someone close to you is bound to agree.

 

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Legend
December 20, 2022

Lol, a mess is created by the user not the tools of the job, even Bootstrap will  create a mess in the wrong hands.  Too depressing to even consider what's going on these days, it's getting worse, no pain, no gain, certainly no control.

BenPleysier
Community Expert
Community Expert
December 20, 2022
quote

If bootstrap was that bad, it would never give you a Lighthuis score of 100, yet this page does

 

By @BenPleysier

 

Zero to do with Bootstrap. I can show you Bootstrap developed websites build in Wappler that score pretty poorly when analysed by lighthouse, particulary in mobile devices if of course you think 54%/69% for 'performance' is a little less than desired.

 

 


Does this mean that Bootstrap is ignored when assigning top marks for performance?

 

In your wisdom, what then differentiates my website from those that perform poorly?

 

To give you a helping hand, have a look at

https://youtu.be/xjiBtwkmUFI

 

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!