Webmaster's Community

Designing and Development => Programming => Topic started by: Anay on February 20, 2011, 02:30:14 PM

Title: How to center image background using CSS in html
Post by: Anay on February 20, 2011, 02:30:14 PM
HI

I am not sure how to center image background in css. I am doing as following:

Code: [Select]
.back
{font-family:Verdana, Geneva, sans-serif;
background:url('images/nbg.jpg') repeat-y;
}

So how do I do it, if I do text-align=center , it has no effect on it.

Kindly guide.
Title: Re: How to center image background using CSS in html
Post by: Jaffery on April 29, 2011, 05:58:43 AM
That is easy, all you need to add "center" directive in your "background" element property.

see it ..
Code: [Select]
.back
{font-family:Verdana, Geneva, sans-serif;
background:url('images/nbg.jpg') repeat-y [b]center[/b];
}

And you are done !