css款式的动态性加上及显示信息和掩藏等零碎用

2021-01-20 09:40 jianzhan
款式的动态性加上:

(在其中鲜红色字体样式是动态性加上款式的句子),这是1个动态性转化成无编码序列表的涵数,用来显示信息检索到的wifi数据信号,在其中有3个主要参数,wifi的名字、数据加密方法、数据信号强度。

拷贝编码
编码以下:

// create a network list item
function newListItem(network, averageSignalStrength) {
/**
* A Wi-Fi list item has the following HTML structure:
* <li>
* <div>"signalStrength"+ dbm</div>
* <small> Network Security </small>
* <a [class="wifi-secure"]> Network SSID </a>
* </li>
*/
// ssid
var _ = navigator.mozL10n.get;
var ssid = document.createElement('a');
ssid.textContent = network.ssid;
var div = document.createElement('div');
<span style="color:#FF0000;">var str_css ="position: absolute;left: 50%; right: 3rem; top: 45%; padding-top: 0.4rem; font-size: 1.4rem; color: #505859; pointer-events: none;";</span>
<span style="color:#FF0000;">div.style = str_css;</span>
if (!averageSignalStrength)
div.textContent = 'strength:'+ network.signalStrength + 'dbm';
else
div.textContent = 'strength:'+ averageSignalStrength + 'dbm';
// supported authentication methods
var small = document.createElement('small');
var keys = network.capabilities;
if (keys && keys.length) {
small.textContent = _('securedBy', { capabilities: keys.join(', ') });
small.textContent = keys.join(', ');
} else {
small.textContent = _('securityOpen');
small.dataset.l10nId = 'securityOpen';
}
// create list item
var li = document.createElement('li');
li.appendChild(div);
li.appendChild(small);
li.appendChild(ssid);
return li;
}

款式的显示信息和掩藏:

遍历标识 exp = document.getElementById("exp");

掩藏标识 exp.style.display = "none";

显示信息标识 exp.style.display = "list-item";

Padding 特性界定元素边框与元素內容之间的室内空间。

padding 简写特性在1个申明中设定全部内边距特性。设定全部当今或特定元素内边距特性。该特性能够有1到4个值

拷贝编码
编码以下:

<span style="font-size:14px;">英语的语法构造
padding-top:20px;上内边距
padding-right:30px;右内边距
padding-bottom:30px;下内边距
padding-left:20px;左内边距
padding:1p4边统1内边距
padding:1px1px左右,上下内边距
padding:1px1px1px上,上下,下内边距
padding:1px1px1px1px上,右,下,左内边距</span>