body .tab ul.tab-nav li a {
text-align: center;
width: 90%;
max-height: 20px;
color: #fff;
font-weight: inherit;
padding: 13px 20px;
cursor: pointer;
margin-left: 5%;
top: 1px;
border: 1px solid #000;
background: rgba(100, 100, 100, 0.8);
}
这是我的CSS代码,当我添加max-height: 20px;
时,文本会从按钮中删除?
答案 0 :(得分:1)
我会说这是function getTree(data) {
var o = {};
data.forEach(function (a) {
var parent = a.ancestors[0];
if (o[a.id] && o[a.id].children) {
a.children = o[a.id].children;
}
o[a.id] = a;
o[parent] = o[parent] || {};
o[parent].children = o[parent].children || [];
o[parent].children.push(a);
});
return o.undefined.children;
}
function buildList(tree, target) {
var ul = document.createElement('ul');
tree.forEach(o => {
var li = document.createElement('li');
li.appendChild(document.createTextNode(o.name));
buildList(o.children || [], li);
ul.appendChild(li);
});
target.appendChild(ul);
}
var data = [{ id: 'id-1', name: 'name1', ancestors: [] }, { id: 'id-2', name: 'name2', ancestors: [] }, { id: 'id-3', name: 'name3', ancestors: ['id-1'] }, { id: 'id-4', name: 'name4', ancestors: ['id-3', 'id-1'] }],
tree = getTree(data);
console.log(tree);
buildList(tree, document.body);
您定义的最高身高只能是let expectations = expectation(description: "AsyncExpectations")
expectations.expectedFulfillmentCount = 4
DispatchQueue.global(qos: .userInteractive).async {
// do work here
expectations.fulfill()
}
DispatchQueue.global(qos: .background).async {
// do work here
expectations.fulfill()
}
DispatchQueue.global(qos: .default).async {
// do work here
expectations.fulfill()
}
DispatchQueue.main.async {
// do work here
expectations.fulfill()
}
// wait for all 4 expectations
waitForExpectations(timeout: 2, handler: nil)
,但您还指定padding: 13px 20px;
将20px
填充在顶部,底部填充a
,填充高度应为23px。尝试在较低的顶部/底部尺寸上调整填充:13px
。