html - HTML:H1 类不居中
问题描述
我是 HTML 新手,我正在尝试使用 css 类将 H1 居中,但它不起作用。一世
我的 HTML 如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div class='title'>
<h1>Technologies</h1>
</div>
</body>
</html>
我的CSS如下:
multi-input {
display: inline-block;
margin: 0 20px 20px 0;
}
button {
background-color: #eee;
border: 1px solid #ddd;
font-size: 16px;
height: 30px;
margin: 0 10px 20px 0;
}
body > div {
align-items: center;
display: flex;
justify-content: center;
}
label {
display: block;
margin: 0 20px 20px 0;
}
div.title {
text-align: center;
}
我从本教程中启发了自己:https ://www.w3schools.com/cssref/pr_text_text-align.ASP
我还尝试h1 {text-align: center;}
在我的 css 中添加它,以便所有 H1 都居中,但它仍然无法正常工作。任何人都可以帮忙吗?谢谢!
解决方案
您必须从<link rel="stylesheet" href="/style.css">
像这样 :<link rel="stylesheet" href="style.css">
推荐阅读
- numpy - 具有矩阵运算的分解机的有效实现?
- php - 如何检查特定键和值在php数组中是否存在3次以上
- c# - 将 umat 与 BackgroundSubtractor 结合使用会导致停止从相机接收帧
- javascript - 使用 Ramda 合并两个具有深度嵌套键的数组
- android - React 本机 android 构建版本代码未更新
- powershell - 从 Powershell 脚本返回对象
- java - 通过 Spring 将对象添加到数据库
- sql - 计算的持久列
- c# - Unity:根据场景之间的对象点击更改相机位置 Unity
- linux - 无法安装来自 ppa for espeak 的 mbrola 西班牙女性声音,我该如何安装?