EN: Add <style> in <head>.
<style>
<head>
ZH: 添加样式标签; style: 样式标签内的字符串; id: <style> 标签的 id; 返回: 添加成功/失败。
id
Example 1: Add the <style> with id, and repeated invoking will update the content instead of adding a new one.
addStyle( ` body { background-color: #333; } `, { id: "test", });// <style id="test">// body {// background-color: #333;// }// </style> Copy
addStyle( ` body { background-color: #333; } `, { id: "test", });// <style id="test">// body {// background-color: #333;// }// </style>
Example 2: Add the <style> without id, and repeated invoking will add a new one.
addStyle( ` body { background-color: #444; } `);// <style>// body {// background-color: #444;// }// </style> Copy
addStyle( ` body { background-color: #444; } `);// <style>// body {// background-color: #444;// }// </style>
Optional
EN: Add
<style>
in<head>
.ZH: 添加样式标签; style: 样式标签内的字符串; id:
<style>
标签的id
; 返回: 添加成功/失败。Example 1: Add the
<style>
withid
, and repeated invoking will update the content instead of adding a new one.Example 2: Add the
<style>
withoutid
, and repeated invoking will add a new one.