center images on a web page for all screen sizes - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

center images on a web page for all screen sizes

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <style>

      </style> 
   </head> 
   <body> 
      <div href="#" style="width:100%;background-color:yellow;">
         &lt;&gt;//from w ww  .j a  va2s.c  o  m
         <img src="http://www.java2s.com/style/download.png">
      </div> 
      <script>
if (document.getElementById('hello')) {
  document.getElementById('hello').innerHTML = 'Hello World - this was inserted using JavaScript';
}

      </script>  
   </body>
</html>

Related Tutorials