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 ?

Recommended Answers

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

Jump to Post

All 4 Replies

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.