gpt4 book ai didi

html - 将文本放在图像旁边的正中间

转载 作者:行者123 更新时间:2023-11-28 13:18:42 24 4
gpt4 key购买 nike

我试图将文本恰好放在图像旁边的 div 中间(水平),并且它必须是可点击的

下面是代码,到目前为止我试过了......

<!DOCTYPE html>
<html lang="en">
<head>
<style>
#div {
width: 128px;
height: 35px;
border: 2px solid #ccc;
}
</style>
<body>
<div id="div">Some service
<a href="http://stackoverflow.com">
<img src="http://upload.wikimedia.org/wikipedia/commons/1/1a/Volkswagen_Logo.png" alt="Stack Overflow" width="40" height="35"title="Click to return to Stack Overflow homepage" />
</a>
</div>
</body>
</html>

Am trying to do like this image

解决方案:

<!DOCTYPE html>
<html lang="en">
<head>
<style>
#div {
width: 128px;
height: 35px;
border: 2px solid #ccc;
}
</style>
<body>
<div id="div">sdasdasdasd
<a href="http://stackoverflow.com">
<img src="http://upload.wikimedia.org/wikipedia/commons/1/1a/Volkswagen_Logo.png" alt="Stack Overflow" width="40" height="35"title="Click to return to Stack Overflow homepage" style="vertical-align:middle"" />
</a>
</div>
</body>
</html>

最佳答案

我想这就是您所需要的? DEMO

<div id="div">  
<a href="http://stackoverflow.com">Some service
<img src="http://upload.wikimedia.org/wikipedia/commons/1/1a/Volkswagen_Logo.png" alt="Stack Overflow" width="40" height="35"title="Click to return to Stack Overflow homepage" />
</a>
</div>

关于html - 将文本放在图像旁边的正中间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14825473/

24 4 0