+ 2

How i set float right to the last element of the menu bar (last li element)

I create a menu bar which also contains a sub menu . I think it works perfectly ? but i cannot target the last element to the right of the navigation bar and other elements are centred on the page along with x axes of navigation bar Thanks for viewing my question. If you can suggest more improvements you can it will help to boost my CSS career https://code.sololearn.com/WZMkc1Oto4i5/?ref=app

8th Dec 2022, 4:45 AM
PARMAR AAYUSH
PARMAR AAYUSH - avatar
7 Antworten
+ 5
nav ul { ... display: flex; justify-content: center ; } With this you can center your menu on the x axis.
8th Dec 2022, 7:01 AM
Hector Romero
Hector Romero - avatar
+ 3
nav ul li:last-child { float: right; }
8th Dec 2022, 6:54 AM
Calviղ
Calviղ - avatar
+ 2
Then you should separate the last element with another nav div. Only then you can style 2 divs with different flex justify content Please check out the new div and css styles https://code.sololearn.com/WuMJXVCPdP8D/?ref=app
8th Dec 2022, 8:29 AM
Calviղ
Calviղ - avatar
0
Thanks You brother Calviղ
8th Dec 2022, 7:55 AM
PARMAR AAYUSH
PARMAR AAYUSH - avatar
0
Thank you brother Hector Alexis Romero Morales but if i use this properties then o can not move last child float right
8th Dec 2022, 7:57 AM
PARMAR AAYUSH
PARMAR AAYUSH - avatar
0
Not please solve both problem to to the center menu items and last child move to the right Calviղ
8th Dec 2022, 7:59 AM
PARMAR AAYUSH
PARMAR AAYUSH - avatar
0
theres a typo, chlid instead of child. and yes its easier with flexbox.
8th Dec 2022, 10:33 AM
arturop200
arturop200 - avatar