Nav tag HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Nav tag HTML

I seem to have trouble adding a style to the nav tags when I code. Do I need to put them in a div or can I treat it as a div? https://code.sololearn.com/WNTW22cDBnc3/?ref=app

25th Feb 2019, 3:25 PM
RyGuy94
RyGuy94 - avatar
3 Answers
0
You can add styles to nav tags using inline CSS through the style="" attribute or you can do it from an external stylesheet by selecting nav or a class or ID. You don't seem to have any CSS rules for nav by itself in your example, only list items in lists in navs.
25th Feb 2019, 5:51 PM
Lachlan
0
So using an inline attribute called style?
25th Feb 2019, 7:06 PM
RyGuy94
RyGuy94 - avatar
0
Yes or in an external stylesheet like you have by writing a rule for "nav" or a class/id name. There's this thing in specificity which means that if you reference something by id in CSS it will override any other rules and so you should keep track of this to not make unwanted errors happen in your stylesheets. A big part of mastering CSS is learning how to control and take advantage of which selectors override what.
26th Feb 2019, 8:21 AM
Lachlan