Author Topic: How to center image background using CSS in html  (Read 6587 times)

Anay

  • Newbie
  • *
  • Posts: 32
How to center image background using CSS in html
« 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.

Jaffery

  • Administrator
  • Full Member
  • *****
  • Posts: 158
Re: How to center image background using CSS in html
« Reply #1 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 !

 

X

Do you know?

By participating in our community you can get free Top Level Domain for lifetime.
Know more..
Join Now!
anything