CSS Align all li items in single row - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Alignment

Description

CSS Align all li items in single row

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
#menu {<!--from w w w.  jav  a 2s .  c  o  m-->
   direction:rtl;
   font-family:tahoma;
   font-size:12px;
   white-space:nowrap;
}

#menu li {
   display:inline-block;
   float:right;
   margin:11px;
   color:Chartreuse;
   background:yellow;
   background:blue;
   -webkit-border-radius:3px;
   -moz-border-radius:3px;
   border-radius:3px;
}

#menu li.active {
   background:pink;
   background:OrangeRed;
   color:grey;
}

#menu li a {
   text-decoration:none;
   color:BlueViolet;
}

#menu li.active a:hover {
   color:Chartreuse;
}

#menu li:hover {
   background:yellow;
}

#menu li a,
#menu li.active a {
   padding:10px 19px;
   display:inline-block;
}

#menu li.active a {
   color:blue;
}

#menu_section {
   position:fixed;
   top:0;
   height:59px;
   z-index:71;
   width:100%;
   padding:0;
   margin:0;
}
</style> 
 </head> 
 <body> 
  <div class="" id="menu_section"> 
   <ul id="menu"> 
    <li data-menuanchor="firstPage"> <img src="https://www.java2s.com/style/demo/Opera.png" width="100px"> <a href="#firstPage">Lorem ipsum</a> </li> 
    <li data-menuanchor="secondPage"> <img src="https://www.java2s.com/style/demo/Safari.png" width="100px"> <a href="#secondPage">Lorem ipsum </a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials