yokks
yokks

Reputation: 5773

displaying image in the center of the screen in iphone webview using css, html

Am using html, css to display an image.

IMG.displayed {
    display: block;
    margin-left: auto;
    margin-right: auto;
    vertical-align: middle
}
 <IMG class="displayed" src="../images/splash.png" alt="...">
 </IMG>

Its not displaying the image in the center of the screen (both vertically & horozontally).

your suggestions please.

Upvotes: 0

Views: 3715

Answers (1)

Red
Red

Reputation: 3159

To align an element both vertically & horizontally you could use the snippet below:

http://jsfiddle.net/catalinred/huKYW/

or

HTML:

<div>content here</div>

CSS

div
{
  width: 300px;
  height: 300px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: -150px;
  margin-top: -150px;
  background: red;
}

Upvotes: 1

Related Questions