【发布时间】:2022-08-11 07:42:22
【问题描述】:
我有这个代码:
<!DOCTYPE html>
<head>
<meta charset=\"utf-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<link rel=\"icon\" href=\"https://toast-shop.opplayz.repl.co/images/logo\">
<title>Toast Discord Bot</title>
</head>
<style>
body {
background-image: linear-gradient(to right, #cfd9f2, #A5B8E7, #cfd9f2);
}
.profile{
margin: 0 auto;
position: relative;
display: inline-block;
}
.profilelogo{
width: 25vw;
height: 25vw;
display: inline-block;
float: left;
}
.profileinfo{
font-family: arial;
}
</style>
<body>
<div class=\"profile\" id=\"profile\">
<img src=\"https://toast-shop.opplayz.repl.co/images/logo\" class=\"profilelogo\" id=\"profilelogo\">
<div class=\"profileinfo\">
<h1>Toast Shop</h1>
<h2>A Discord Bot that brings fun to your server</h2>
</div>
</div>
</body>
我希望我的图像和文字看起来像这样:
在较大的屏幕上,h1 和 h2 元素位于页面顶部,而图像位于中间。我希望文本与图像水平对齐。我怎么能用css做到这一点?
标签: html css alignment web-frontend