How to make image stretch to a specific paragraph?

后端 未结 2 1194
挽巷
挽巷 2020-12-21 21:24

Here is the prototype I am trying to implement \"enter Here is what I have right now.

2条回答
  •  渐次进展
    2020-12-21 21:47

    Taking a shot in the dark without looking at all the code. How are you creating your image, in an tag or as the background of a div via the css attribute background:url("image.png");? The height and width percentages reference the dimensions of that elements parent element. I'm going to assume that your image has no parent element/container, or that the parent/element container is not set to specified height. Therefore your element is referencing the Viewport who's height attribute is automatically set to auto. Set your HTML and Body elements height attribute to 100%.

    html,body{
       height:100%;
    }
    

提交回复
热议问题