/    Sign up×
Community /Pin to ProfileBookmark

transition problem

Hello coders ?
I have a list to choose language from
I need to add a smooth effect on hover (ul) so that (li) slides slowly, and also a smooth effect on hover language (li) itself
It works fine when I hover the (li) itself, but doesn’t work on (ul) hover
what’s wrong am I doing?

here are the codes:
1- HTML code


************

<div class=”lang-selector”>
<ul>Hover to Select Language
<li><a href=”#”>English</a></li>
<li><a href=”#”>Francais</a></li>
<li><a href=”#”>Espanol</a></li>
</ul>
</div>

CSS code


********

ul
{
margin: 0 10px 0 0;
background-color: #ccc;
float: right;
list-style: none;
width: fit-content;
z-index: 1;
padding: 5px;
float: right;
transition: all 0.5s ease-in-out;
}

ul:hover li
{
border-right: 2px solid #999;
padding: 0 5px;
background-color: #000;
color: #fff;
display: inline;
}

li{

text-align: center;
cursor: pointer;
float: left;
display: none;
transition: all 0.5s ease-in-out;

}

ul li:hover
{
background-color: yellow;
color: #000;
}

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumJan 11.2019 — If I understand you correctly you intend to make the li's visible by a slide effect. The reason why this doesn't work is, that display cannot be animated. You need to change the width instead.

Note: W3C validator says:
Error: Text not allowed in element ul in this context.

From line 44, column 13; to line 44, column 36

<ul>Hover to Select Language↩ [/quote]

I recommend moving the text outside the ul.
Copy linkTweet thisAlerts:
@HanyTauthorJan 11.2019 — @Sempervivum#1599829 i used divs instead of ul and li and opacity instead of display it works fine

Thanks Mate ?
×

Success!

Help @HanyT spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...