Html 将标题置于上方并居中

Html 将标题置于上方并居中,html,css,Html,Css,我得到了改进代码的建议。我想这里缺少我需要的。 除了缺少h1之外,建议的代码工作正常 我的代码是 <!--#include file="constants/dbopen.asp" --> <html> <head> <title>Database</title> </head> <style> .body { display: flex; justify-content: center; ba

我得到了改进代码的建议。我想这里缺少我需要的
。 除了缺少h1之外,建议的代码工作正常

我的代码是

<!--#include file="constants/dbopen.asp" -->
<html>
<head>
<title>Database</title>
</head>
<style>    
.body {
  display: flex;
  justify-content: center;
  background: rgb(2,0,36);
  background: linear-gradient(356deg, rgba(2,0,36,1) 0%, rgba(9,9,121,0.7455357142857143) 28%, rgba(0,212,255,1) 100%);
}
.headline {
  display: flex;
  text-align: center;
  color: #4400CC
}

.container {
  width: 80%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  padding: 10px 10px;
}

.image-and-text {
  max-width: 15%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 0;
  font-family: comic sans ms;
  color: #FFFFFF;
}

.image {
  width: 100%;
}
</style>
<body class="body">
<br>
<h1 class="headline">Database</h1>
<%
Dim strSQL
strSQL = "SELECT filmid, titel, billede FROM film ORDER By Titel ASC"
Set rs = conn.Execute(strSQL)
Response.Write("<div class='container'>")
If rs.BOF And rs.EOF Then
' No data
Else
Do While (Not rs.EOF)
Response.Write("<div class='image-and-text'>")
Response.Write "<img src='img/" & rs("billede") & "' class='image'/>"
Response.Write "<div>" & rs("titel") & "</div>"
Response.Write "</div>"
rs.MoveNext
Loop
End If
Response.Write("</div>")
%>
</body>
</html>
<!--#include file="constants/dbclose.asp" -->

数据库
.身体{
显示器:flex;
证明内容:中心;
背景:rgb(2,0,36);
背景:线性梯度(356度,rgba(2,0,36,1)0%,rgba(9,9121,0.7455357142857143)28%,rgba(0212255,1)100%);
}
.标题{
显示器:flex;
文本对齐:居中;
颜色:#4400CC
}
.集装箱{
宽度:80%;
显示器:flex;
弯曲方向:行;
柔性包装:包装;
证明内容:周围的空间;
填充:10px 10px;
}
.图像和文本{
最大宽度:15%;
显示器:flex;
弯曲方向:立柱;
对齐项目:居中;
利润率:10px0;
字体系列:comic sans ms;
颜色:#FFFFFF;
}
.形象{
宽度:100%;
}

数据库
有一个
标签,可以将所有内容居中放置。HTML代码设置为在代码中按位置放置元素,因此只要它位于Body标记的顶部,它就会保持在页面的顶部。不需要太多css

首先,您可以发布输出的html。另外,body不需要类,只需执行
body{/*您在这里的样式*/}
。。因为它是本地标记。h1标签也是一样,您可以只使用h1。。另一个本机标记您希望我如何发布输出?我曾尝试用css设计h1样式,但我无法将其置于图像上方并居中。自html5问世以来,中心标记已过时,不应使用此标记