我试图将文本正好放在图像旁边的 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>
解决方案 :
<!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>