I have an image and i want to center it with

margin: 0 auto;

but it doesn't work so how can i center it in the top of the page ?

Put it in a div, give the div a width, and centre the div.

Put it in a div, give the div a width, and centre the div.

I did what you said but it didn't work !!!!

<div id="header">
<img src="........" </img>
</div>

and in css

#header {
width: 551px;
margin:0 auto;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.