我正在显示从<li>标签生成的具有固定高度和宽度的行数.现在我需要在垂直中心对齐文本.CSS vertical-align没有影响,也许我错过了什么?
我不是在寻找使用(边距,填充,行高)的技巧,这些都行不通,因为有些文本很长并且会分成两行.
请找到实际代码:
ul.catBlock{
width:960px;
height: 270px;
border:1px solid #ccc;
}
ul.catBlock li{
list-style: none;
float:left;
display:block;
text-align: center;
width:160px;
height: 100px;
}
ul.catBlock li a{
display: block;
padding: 30px 10px 5px 10px;
height:60px;
}
Run Code Online (Sandbox Code Playgroud)
<ul class="catBlock">
<li><a href="#">IP Phone</a></li>
<li><a href="#">Dual SIM Switch Server</a></li>
<li><a href="#">IP PBX</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud) 我想让代码编辑器左侧的图标(资源管理器、搜索、源代码管理等)变小。但是当我这样做时command -,它也会减小编辑器中代码字体的大小。我该怎么办?
var fruits = [];
fruits.push("lemon", "lemon", "lemon", "lemon");
Run Code Online (Sandbox Code Playgroud)
而不是推动相同的元素,如何像这样写一次:
fruits.push("lemon" * 4 times)
Run Code Online (Sandbox Code Playgroud) create-react-app foldernameA
我想将文件夹名称更改为foldernameB。命令是什么?
<h3>单击复选框时如何显示此标记?现在它被隐藏了.
<h3 class="bark">Bark Bark</h3>
<input type="checkbox" class="title">Hear a dog</input>
Run Code Online (Sandbox Code Playgroud)
CSS:
.bark{
visibility: hidden
}
input[type="checkbox"]:checked {
visibility: visible
}
Run Code Online (Sandbox Code Playgroud) 从我所看到的你甚至可以缓存一个网页.根据此文档:https://www.mnot.net/cache_docs/#BROWSER,表示可以缓存在浏览器缓存中.我看到甚至服务工作者完全一样(html,css和javascript文件).服务工作者的目的是什么?
我正在尝试逐渐减小字体的大小.但看起来它变小时会摇晃.如何让它看起来光滑?
.name:hover {
color: green;
transition-property: font-size;
transition-duration: 2s;
transition-timing-function: ease;
font-size: 5px;
}Run Code Online (Sandbox Code Playgroud)
<div class="name">Name</div>Run Code Online (Sandbox Code Playgroud)
如何获取本地json。错误说Unexpected token < ..。我没有网络错误。
项目列表.js:
import React, { Component } from 'react';
class Itemslist extends Component {
componentDidMount() {
fetch('items.json').then(res => {
console.log(res)
// return res.json()
}).then(res => {
console.log(res)
})
}
}
Run Code Online (Sandbox Code Playgroud)
以下是我在开发工具中得到的回应
Response {type: "basic", url:
"http://localhost:5000/items.json", redirected: false, status: 200, ok: true, …}
body: ReadableStream
bodyUsed: true
headers: Headers {}
ok: true
redirected: false
status: 200
statusText: "OK"
type: "basic"
url: "http://localhost:5000/items.json"
__proto__: Response
Run Code Online (Sandbox Code Playgroud)
虽然响应是 200,但我收到以下错误:
bundle.js:30 Uncaught (in promise) SyntaxError: Unexpected token < in …Run Code Online (Sandbox Code Playgroud) 为什么我无法映射对象数组。我以前使用过这个地图,但它似乎在这个组件中不起作用。知道出了什么问题吗?
import React, { Component } from "react";
class Home extends Component {
constructor(props) {
super(props);
this.state = {
people: [
{name:"a", age: 21},
{name:"b", age: 22},
{name:"c", age: 23}
]
}
this.clickListnerHandler = this.clickListnerHandler.bind(this)
}
clickListnerHandler(e){
console.log(this.state.people)
}
render(){
return (
<div>
{this.state.people.map((detail, index) =>
{detail.name}
)}
<button
onClick={this.clickListnerHandler}
type="button" >Click on me</button>
</div>
)
}
}
export default Home
Run Code Online (Sandbox Code Playgroud)