css - Techniques for placing text over a background image -


have @ website http://startbootstrap.com/templates/grayscale/ introductory text placed on background image. in case - use table display text

.intro { display: table; width: 100%; height: auto; padding: 100px 0; text-align: center; color: #fff; background: url(../img/bg.jpg) no-repeat bottom center scroll; background-color: #000; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; -o-background-size: cover; }

of course way of achieving use absolute positioning taking mobile-first approach - i'm curious know lightweight solution (least amount of css) while keeping best practices!

i guess it's background: url styling that's crux of it. can use on div though. rest of styling div (text colour/div size).

here's minimalist example - works fine on android phone:

<html> <head> <style type="text/css"> div {     background: url(http://www.thewebbery.co.uk/web04/skp/files/pitp1.jpg);     color:#ffffff;     width:900;     height:600;  } </style>  </head> <body> <div> here's text on image  more on image here's text on image  more on image here's text on image  more on image here's text on image  more on image here's text on image  more on image here's text on image  more on image  </div> </body> </head> 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -