Ok i have written a CSS code for body

body
{
	margin: 0 auto;
}

#header
{
	font-family: Georgia,Times,serif;
}

With the CSS code for body everything that's inside the body should be placed in the center of the page because the body is in the center.

In html i have written a paragraph with p tag and an id of header inside the body but the problem is that the paragraph instead of appearing in the center appears at the left most side of the page.

What's the problem shouldn't the P tag appear in center as it is inside the body ?

Recommended Answers

All 2 Replies

You haven't given the body a width less than 100% - therefore your body is 100% wide and the p is exactly where it belongs - on the left side of the body. If you want every thing inside the body centered that's

text-align:center;

You haven't given the body a width less than 100% - therefore your body is 100% wide and the p is exactly where it belongs - on the left side of the body. If you want every thing inside the body centered that's

text-align:center;

Thank you now i exactly understand the problem.

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.