开发者

set 100% width and a maxwidth of 400px?

开发者 https://www.devze.com 2023-04-10 08:02 出处:网络
I want to do the folowing: image.style.maxWidth = \"400px\"; image.style.width = \"100%\"; so the image maxwidth is 400px but if the user resizes his webbrowser window to a width of -400px the image

I want to do the folowing:

image.style.maxWidth = "400px";
image.style.width = "100%";

so the image maxwidth is 400px but if the user resizes his webbrowser window to a width of -400px the image will be resized to the same with as the window. The problem is: How do you this is non maxwidth browser? is there any way of doing this without using maxwith开发者_高级运维?


You can use this css3 rule:

@media only screen and (min-width: 768px) and (max-width: 991px) {

#image {
    width: 400px;
}
}

Go and check http://lessframework.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消