- Modify styles through JS: the styles modified by this method are inline styles with high priority. However, if “! Important” is used in the style, the modification of JS will not work.
Syntax: element.style.styleName = styleValue ; The style value must be a string Note: If the style of css contains " - " , this name is not legal in JS, you need to change this style name to camel naming, remove the " - " and change the initial letter to uppercase.
The styles set and read through the style property are inline styles
- get the display style of the current element:
Syntax: element.currentStyle.styleName currentStyle is only supported by IE browser
In other browsers, you can use the getcomputedstyle() method to get the current style of the element. This method is a window method and can be used directly. This method will return a style object that encapsulates the corresponding style of the current element.
Two parameters are required The first: the element to get the style The second: you can pass a pseudo-element, which is usually null
Note: the styles obtained through currentstyle and getcomputestyle are read-only and cannot be modified. If you want to modify them, you must use the style property </OL> to modify them
- The solution to the problem that the custom styles of UI components such as element-ui in the vue project do not take effect
- [Solved] Uni.createintersectionobserver Error: Uncaught TypeError: Cannot read property ‘bottom’ of null
- Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs）
- Full screen scrolling by Vue + Vue awesomeswiper
- Element-plus Warning: ElementPlusError: [Util] binding value must be a string or number.
- JS uses onerror to automatically catch exceptions
- [Solved] Error:Plugin/Preset files are not allowed to export objects, only functions
- Syntax Error: Error: PostCSS received undefined instead of CSS string
- How to Solve “Vue is not defined” Error
- [Solved] Cannot read property ‘setCheckedKeys‘ of undefined“
- How to Solve VUE Error: Avoid mutating a prop directly since the value will be overwritten …
- [Solved] Less Install Error: TypeError: this.getOptions is not a function
- [Solved] Vue Project Start Error: Support for the experimental syntax ‘jsx‘ isn‘t currently enabled
- How to introduce iconfont into uni-app
- [Solved] Error: #error More than 1 blank line not allowed no-multiple-empty-lines
- [Solved] Vue Error: Module build failed: Error: No PostCSS Config found in
- CSS to achieve dynamic display of picture text by mouse touch
- Vue: initialize failed: invalid DOM [How to Solve]
- [Solved] Vue Error: Duplicate keys detected: ‘74004’. This may cause an update error