Category: Javascript

Using Javascript to get an element’s style

There are different ways to get the style of an HTML element using Javascript. The typical way that developers use to access styles of an element is the HTMLElement.style property. It is the simplest way to access style properties. However, the HTMLElement.style property has a limitation that can affect your code if you do no account for it. The HTMLElement.style property only accesses inline styles of an element, that is, styles that are specified in the style attribute of the element’s tag on the webpage. This creates a problem for most situations where the style is specified in a separate stylesheet CSS file or in a CSS style declaration in the head of the webpage. Fortunately, there is a simple way to deal with this in Javascript. Continue reading “Using Javascript to get an element’s style”

Recent Posts

Archives

Categories




Users Online

1 User Browsing This Page.
Users: 1 Guest

Meta




GiottoPress by Enrique Chavez