Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I center an image using jqmobile

Hi i am using this piece of code to center image in jquery mobile, it centers the image in iphone simulator but when i check it on iphone, it did not exactly centers (centers itself but not exactly) itself but tends towards left.

<div data-role="content" data-theme="a">

   <div id="logo_image">
       <img src="images/logo.png"  alt="Image Header" >
   </div>

</div>

and the css is

#logo_image {
  text-align: center;
  margin-left:0 auto;
  margin-right:0 auto;
}

Thanks in advance...

like image 951
h_a86 Avatar asked Jan 18 '23 12:01

h_a86


2 Answers

just try margin: 0 auto instead of left & right margin. you'll be able to set the top and bottom margin afterwards. greets

like image 142
CyrillC Avatar answered Jan 29 '23 20:01

CyrillC


Try to add diplay: block to your image it should position it right.

like image 39
Razz Avatar answered Jan 29 '23 21:01

Razz