gpt4 book ai didi

html - 如何对齐左边的图像和中间的标题?

转载 作者:行者123 更新时间:2023-11-28 10:34:32 34 4
gpt4 key购买 nike

我尝试使用下面的代码,但标题出现在下一行。代码如下:

<div style="display:inline;">
<img src="abc.png" style="margin:10px 10px 10px 10px;width:97px;height:50px;" />
<h5 style="display:inline-block">Hello</h5></div>

Incorrect result预期输出!! enter image description here

最佳答案

像下面这样改变你的风格。将 float:left; 添加到 img 和 h5 标签 以获得结果。

更新的输出

enter image description here

<!DOCTYPE html>
<html>

<head>
<title>Page Title</title>
</head>

<body>
<div style="display: inline-block;width: 100%;">
<img src="https://smallbusinesssaturdayuk.com/Images/Small-Business-Saturday-UK-Google-Plus.gif" style="float:left;" />
<h5 style="text-align:center;">Hello</h5>
</div>
</body>

</html>

关于html - 如何对齐左边的图像和中间的标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39161005/

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