i am trying to put text over image it works but is there a better way to do it. should i use a different html tag for the text. any suggestions
body{ background-color:#F0F0F0 ; color:#000305; font-size: 87.5%; font-family: Arial,'Lucida Sans Unicode'; line-height: 1.5; text-align: left; width:80%; margin:2% auto; } .main { width:45%; height:300px; background-color: #20b2aa; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; } .main img{ width:80%; height:auto; margin: 6% 10%; float: left; } .main h2 { color:white; position: absolute; margin:50px; margin-left: 50px; width: 100%; }
backgroundto adiv. Then you wouldn't have to useposition:absoluteto position the text.:afterand:beforepseudo element. but finally up to you. what's is your project requirement.