HTML CSS examples for CSS Widget:UL
Set the width of a parent div dynamically based on the width of a ul
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div#subNav {<!-- w ww . j ava2s . co m--> text-align:center; } div#subNav ul { display:inline-block; background:Chartreuse; padding:6px 0 6px 6px; } div#subNav ul li { float:left; margin:0 6px 0 0; padding:3px 5px; background:yellow; } div#subNav ul li a { color:blue; text-decoration:none; text-shadow:0 2px 0 pink } </style> </head> <body> <div id="subNav"> <ul id=""> <li> <a href="">Lorem ipsum dolo</a> </li> <li> <a href="">Lorem ipsum do</a> </li> <li> <a href="">Lorem ipsum dolor</a> </li> <li> <a href="">Lorem ipsum dolor sit</a> </li> <li> <a href="">Lorem ipsum </a> </li> </ul> <ul> <li> <a href="">Lorem ipsum dolor</a> </li> <li> <a href="">Lorem ipsum dolor sit</a> </li> <li> <a href="">Lorem ipsum </a> </li> </ul> </div> </body> </html>