Get the calculated style in the CSS element (after cascading/final style)

Get the calculated style in the CSS element (after cascading/final style)
To obtain the calculated style in a CSS element (that is, the final style after cascading), browsers that support W3C can use the document.defaultView.getComputedSyle method.
This method accepts two parameters. The first parameter is the element to be styled, and the second parameter is a pseudo-element string (for example: ":after". If there is none, it is set to null.
This method returns a StyleSheetDeclaration object, and the final style property value is obtained through the getPropertyValue(propertyName) of the object. Note that the proprtyName here is of type wrold-world (eg background-color).
In IE, the element.currentStyle[propertyName] method is used. Note that the propertyName here is of the worldWorld type (such as: backgroundColor).

<<:  What is the use of the enctype field when uploading files?

>>:  JavaScript implementation of magnifying glass details

Recommend

Detailed examples of variable and function promotion in JavaScript

js execution Lexical analysis phase: includes thr...

The marquee tag in HTML achieves seamless scrolling marquee effect

The <marquee> tag is a tag that appears in ...

Vue realizes click flip effect

Use vue to simply implement a click flip effect f...

Incomplete solution for using input type=text value=str

I encountered a very strange problem today. Look a...

Web Design Tutorial (5): Web Visual Design

<br />Previous article: Web Design Tutorial ...

Node.js+postman to simulate HTTP server and client interaction

Table of contents 1. Node builds HTTP server 2. H...

Let me teach you how to use font icons in CSS

First of all, what is a font icon? On the surface...

Detailed Example of MySQL InnoDB Locking Mechanism

1. InnoDB locking mechanism The InnoDB storage en...

js realizes the image cutting function

This article example shares the specific code of ...

How to change the default character set of MySQL to utf8 on MAC

1. Check the character set of the default install...

MySQL multi-instance installation boot auto-start service configuration process

1.MySQL multiple instances MySQL multi-instance m...

How to set a fixed IP in Linux (tested and effective)

First, open the virtual machine Open xshell5 to c...

Several ways to implement "text overflow truncation and omission" with pure CSS

In our daily development work, text overflow, tru...