gpt4 book ai didi

html - 居中 png 图像

转载 作者:太空宇宙 更新时间:2023-11-04 06:44:50 24 4
gpt4 key购买 nike

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Name of your Animal</title>
<link rel = "stylesheet"
type = "text/css"
href = "style1.css" />

</head>
<body>

<img src="jags2.png" alt="jaguar">
<img align="right">


<p> Add some info on your animal </p>
</body>
</html>

我正在尝试制作一个关于美洲虎的网站,我插入了一张美洲豹的照片,但它一直显示在左上角。我正在尝试将其居中对齐,但行不通,请帮忙。

最佳答案

尝试以下引用:https://www.w3schools.com/css/css_align.asp

.center img {
margin: 0;
position: absolute;
top: 100%;
left: 50%;
transform: translate(-50%, -100%);
}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Name of your Animal</title>
<link rel = "stylesheet"
type = "text/css"
href = "style1.css" />

</head>
<body>
<div class="center">
<img src="https://tpc.googlesyndication.com/simgad/11423376298074074248" alt="jaguar">
</div>

</body>
</html>

关于html - 居中 png 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53402178/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com