1

I have a JSP page with jQuery included.

I have a CSS file with a good load of lines in, I would like to read some specific styles for a given element(eg: header/footer) from the external CSS file into my jsp page using jquery.

3
  • If you're doing this to try to save bandwidth, it's the wrong method. The browser will have to download the whole file before Javascript can parse it. Split your CSS into multiple files instead. Commented Apr 4, 2012 at 8:43
  • @interrobang no i am not trying to save bandwidth.I need to take the header and footer height(if there are any form used then take its height also), then sum all,then I need to subtract the sum value with the screen height and pass the same to set the grid height in my jsp page
    – john
    Commented Apr 4, 2012 at 12:26
  • you dont need to do that , just attach the css file with a link tag , then read the width() or the height() of the element you want directly with jQuery , then do whatever you need to do with it. the css file is parsed by the browser , why would you want to parse it is java or javascript ? it makes no sense.
    – mpm
    Commented Apr 4, 2012 at 13:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.