HTML CSS examples for CSS Layout:Absolute Position
Aligning elements inside absolutely positioned div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .menu {<!-- w ww . j av a 2s. co m--> width:301px; height:100%; position:absolute; left:0px; top:0px; z-index:11; background:Chartreuse; } .icon-block { width:51px; height:51px; display:inline-block; background-color:yellow; background-image:url('http://www.java2s.com/style/demo/Google-Chrome.png'); background-repeat:no-repeat; } .text-block { float:right; width:231px; height:51px; display:inline-block; background:blue; } .a-block { display:block; } </style> </head> <body> <div class="menu"> <a href="#" class=""> <div class="icon-block"> <!-- VOID BLOCK, BACKGROUND IMAGE --> </div> <div class="text-block"> <span>Home</span> </div> </a> <div class="icon-block"> <!-- VOID BLOCK, BACKGROUND IMAGE --> </div> <div class="text-block"> <a href="#" class="a-block"> About </a> </div> </div> </body> </html>