Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery CSS calc() function

Tags:

jquery

css

i came across this page CSS LINK i could't help but love the idea of that to calculate the outcome of different units... however i tried this :

$('selector').css({'width':'calc(100%-20px)'});

but it doesn't work... anyone has any ideas how this works , or why doesn't this work?

like image 463
Val Avatar asked Dec 13 '22 00:12

Val


1 Answers

jQuery supports the calc(). I have used this so many times:

  1. $(".content-section").css('width','calc('+contentSectionWidth+'% - 15px)');

  2. $(".content-section").css('width','calc(100% - 15px)');

like image 193
Ravi verma Avatar answered Dec 15 '22 14:12

Ravi verma