0

我试图将文本正好放在图像旁边的 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>
4

1 回答 1

0

我想这就是你需要的吗?演示

<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>
于 2013-02-12T04:49:02.227 回答