Shrink image using javascript
4 answers
You cannot resize the background with JS.
You can split the image into 4 corner images and split the nests to display all of them:
<div style="background:url(tl.jpg) top left no-repeat">
<div style="background:url(tr.jpg) top right no-repeat">
<div style="background:url(bl.jpg) bottom left no-repeat">
<div style="background:url(br.jpg) bottom right no-repeat">
content
</div>
</div>
</div>
</div>
Of course, you can simplify this if the div only grows on one axis:
<div style="background:url(top.jpg) top no-repeat">
<div style="background:url(bottom.jpg) bottom no-repeat">
content
</div>
</div>
+1
a source to share
Most modern browsers will allow you to traverse the corners of an element without resorting to background images. Check out the following CSS styles ...
-moz-border-radius:4px;
border-radius:4px;
-webkit-border-radius:4px;
Each will give you a 4 pixel radius. The first is in Mozilla browsers (like Firefox), the second is newer css3 browsers and the last is in Safari, etc.
0
a source to share