July 3, 2010

how to set image width and height 100% from css?

Question by mina

my code-

background:url(images/menu_edu.jpg) no-repeat;

but but only half of image is getting displayed.

Answer by Starx

If you want to display your image in full size, no need to use CSS for this

Dont give height and width attribute to the <img> tag like
<img src="this.jpg" /> it will display in full size

But if you want your <div> to show its background in full size, then is no other option than assigning the exact image dimensions

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!