HTML CSS examples for CSS Widget:UL Element
Pushing the last 2 li elements to the right
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .container {<!-- w w w. ja v a 2s . c om--> width:301px; list-style-type:none; background-color:Chartreuse; } .container li { width:31px; display:inline; background-color:yellow; } .container li:nth-last-child(-n+2) { width:81px; display:inline; float:right; background-color:blue; } </style> </head> <body> <div class=" "> <ul class="container"> <li>Lorem ip</li> <li>Lorem ip</li> <li>Lorem ip</li> <li>Lorem ipsu</li> </ul> </div> </body> </html>