6 Replies - 1969 Views - Last Post: 11 April 2012 - 05:39 PM

#1 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 138
  • View blog
  • Posts: 840
  • Joined: 21-December 11

how to center image without align attribute

Posted 10 April 2012 - 05:43 PM

please tell me how to center image or div without align attribute. I'm working with ms web expression. Thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: how to center image without align attribute

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: how to center image without align attribute

Posted 10 April 2012 - 06:22 PM

Do you mean the HTML align tag? Are you allowed to use CSS?
Was This Post Helpful? 0
  • +
  • -

#3 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 138
  • View blog
  • Posts: 840
  • Joined: 21-December 11

Re: how to center image without align attribute

Posted 10 April 2012 - 06:28 PM

yes without HTML align tag. Yes I can use CSS, and i think this is only way.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3554
  • View blog
  • Posts: 10,335
  • Joined: 08-June 10

Re: how to center image without align attribute

Posted 10 April 2012 - 10:37 PM

the CSS properties of concern for that are
- text-align
- vertical-align
- padding
- margin
Was This Post Helpful? 1
  • +
  • -

#5 amit.soni  Icon User is offline

  • D.I.C Head

Reputation: 26
  • View blog
  • Posts: 73
  • Joined: 19-November 10

Re: how to center image without align attribute

Posted 10 April 2012 - 11:10 PM

you can also do this way to make your image in center of the page

<html>
<head>
<style>
img
{
	position:absolute;
	width:50px;
	height:50px;
	left:50%;
	margin-left:-25px; // - (half of your image width)
	}
	
</style>
</head>
<body>
<img alt="" src="close.png">
</body>
</html>


This post has been edited by amit.soni: 10 April 2012 - 11:13 PM

Was This Post Helpful? 2
  • +
  • -

#6 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 138
  • View blog
  • Posts: 840
  • Joined: 21-December 11

Re: how to center image without align attribute

Posted 11 April 2012 - 05:15 PM

thank you for help!
Was This Post Helpful? 0
  • +
  • -

#7 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1377
  • View blog
  • Posts: 3,502
  • Joined: 28-November 09

Re: how to center image without align attribute

Posted 11 April 2012 - 05:39 PM

margin: 0 auto;
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1