First, for fixed positioning, use the top , bottom , left , right attributes instead of margin-top , margin-right ..
Secondly, you applied the same z-index 's to siblings.
Thirdly, using the img element for the background this way is not the best solution. You have to go for CSS background-image for body or text-div wrapper stretched to 100%.
Complete solution:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script> $(document).ready(function(){ </script> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Train of Thought</title> <style type="text/css"> body { width: 100%; height: 100%; margin: 0; padding: 0; background-image:url(http://25.media.tumblr.com/6d28260f10f17c0d2eab47398fd855f6/tumblr_mj9ha54DuW1rub5xuo1_1280.jpg); background-position: top center; background-repeat:no-repeat; } .content { top: 40%; display: block; position: fixed; text-align: centre; z-index: 1; background-color: transparent; font-size:1.5em; opacity: 0.697; border-style: none; } #thought_text{ left: 25%; right: 25%; color:#000; } </style> <body> <div class="content" id="thought_text">Here goes the text<br></div> </body> </head>
Arkadiusz lendzian
source share