How to define variable with CSS value from HTML tag? [closed]


Tags: javascript,css

Problem :

How to change value of element.style.fontSize? I have the font HTML element with inline style font-size: 20px; how do i change size of this using JS? Getting this by element.style.fontSize will give "20px" not just 20. So how can I get rid of "px"



Solution :

You can use parseInt, it will remove the px

var rozmiar = parseInt(divek.style.fontSize);

    CSS Howto..

    How to stack and hide images in a Div in order to animate between them (without floats)

    HTML & CSS: How to put quotation mark and text in same height?

    How to center a navigation bar properly? [closed]

    How to disable the letter tail from the last letter of a word in CSS?

    How to create a CSS3 animation that resembles an image fill up effect?

    How to run a different html file when device width changes?

    CSS: How to blur background image within the div?

    How to get this code to behave differently based on what exactly is clicked?

    How to prevent an empty img element from shrinkage?

    How to use Segoe Print font in CSS?

    How to use resolution relative css files?

    How can i make a div to slide in from right side to left?

    Why does first slideshow image click skip transition and go straight to image?

    How do we write a CSS “block-level-style” within an inline style attribute tag?

    How to rotate the text Rotation with center to the Number

    How to center two blocks with some gap inbetween using CSS?

    How to trigger css3 rotate effect by clicking?

    How do you make these div elements display correctly?

    how to make div with one line of text and div with two the same height?

    How to bring in the right margin of a paragraph with border

    How to compile or convert sass / scss to css with node-sass (no Ruby)?

    How to set line spacing of an ordered list consistently across browsers?

    CSS: how to make scrollbar appear outside div's border?

    In how many ways and places we can place comment in CSS?

    How to import a selector style into another selector style?

    How to make a sudoku grid using HTML and CSS?

    How to Tie Events to CSS

    How to inherit css from grandparent tag? [duplicate]

    How to make one string from a sentence capital in HTML/CSS?

    How to extract icon from picture and display it in page? (by javascript or jquery or css)