css width interval -
OK, this is a problem I've never played before. I want to use CSS to specify that the width of an element should always be in 10 pixels interval. Therefore, for example, if the width of an element is 11, then it will collapse to 20, 56 => 60, 138 => 140, etc. ...
I suspect that one way of CSS Do this but thought I would ask anyway. Something good would be like this:
div {width-interval: 10px; }
There is no such asset in CSS, but you are capable of width of style Elements with extra JavaScript such as:
& lt; Script type = "text / javascript" & gt; $ (Function () {var widthInterval = 20; $ ('div'). (Function () {var $ this = $ (this); var divisions = parseInt ($ this.width () / widthInterval) + 1; Var resWidth = (divisions * width interval) + "px"; $ this.css ('width', resWidth); console.log ("result width:" + resWidth;));}); & Lt; / Script & gt;
Hope it helps.
Comments
Post a Comment