+ 2

How can i align a <li> item horizontally.

Just as in case of a <ol> and <ul> too. Like = #Home #Blog #Contact, in the same line! P. S. Suppose "#" as a bullet.

14th Jan 2018, 9:33 AM
Amit Raj
9 Answers
+ 4
<!-- You could replace <ul> by <ol>, but that's less semantically meaningfull, as to display those kind of list horizontally (inlined), you often doesn't want to display bullets/indexes: --> <ul class="inlinedList"> <li>item</li> <li>another item</li> <li>last item</li> </ul> <style> .inlinedList { padding:0; /* defaut list behaviour shift the content to the right */ list-type-type:none; /* disable bullets/indexes */ /* here just not mandatory visual style for the example */ background:silver; text-align:center; } .inlinedList > li { display:inline-block; /* here you maybe want to style each list item to visually separate them ^^ */ background:dimgray; color:white; padding:0.5ex; margin:0.25ex } </style>
14th Jan 2018, 11:08 AM
visph
visph - avatar
+ 4
Is it necessary to add list items in nav tag or i can use any other element like anchor tag without li tag in nav !?
14th Jan 2018, 11:53 AM
Amit Raj
+ 3
👍😁😂 ok let see... And wait for someone genius.
14th Jan 2018, 9:46 AM
Amit Raj
+ 3
I joined... 👍😊
14th Jan 2018, 9:48 AM
Amit Raj
+ 2
Nice question
14th Jan 2018, 9:43 AM
KRITESH OJHA
KRITESH OJHA - avatar
+ 2
@kritesh ojha Do you know the answer?
14th Jan 2018, 9:45 AM
Amit Raj
+ 2
It's not mandatory to use any tags, and you can use a <nav> to contain <a> without <ul><li>, but it's often used by this way, because it's semantically well suited for any list ;)
14th Jan 2018, 12:20 PM
visph
visph - avatar
+ 2
Thanks a lot @visph👍😊
14th Jan 2018, 12:28 PM
Amit Raj
0
nope
14th Jan 2018, 9:46 AM
KRITESH OJHA
KRITESH OJHA - avatar