set 100% width and a maxwidth of 400px?
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/
精彩评论