Sunday 15 January 2012

responsive css width with % -


I am making a beginning in CSS, and I have tried to find an answer in eBooks and Google, but I searched it Did not get. So please bear with me: D

I want to make a responsive web, so this is my meta tag :

    

This is a part of my code, which responds to a large width image:

  & lt; Div id = "desc" & gt; & Lt; Img alt = "src =" picture / MallDetail / MallDesc.png "& gt; & Lt; / Div & gt;   

This to fit the image with the current screen , I tried to make it bigger in the form of the width of the current screen with CSS. However, the following code is working not :

  #desc {width: 100%; }   

So, I tried this CSS and its work :

  #desc img {width: 100%; }   

My question is, why the first CSS code is not working? This should be the same as the other. Is this%? Or Meta above the tag?

For your time, you can type "div-text" itemprop = "text">

Specify 100% width of the div element (which is already 100% wide by default, as a block element), but the image is an inline-substituted element by default, thus it will not increase its width. In the second rule, you are specifying the width instead of the picture, so the resultant effect is to stretch the image.

No comments:

Post a Comment