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>
完全重複:http://stackoverflow.com/questions/489340/how-do-i-vertically-align-text-next-to-an-image-with-css – 2013-02-12 04:45:09
這是HTTP: //jsfiddle.net/SYxcX/你需要什麼? – coder 2013-02-12 04:47:21
謝謝兄弟,我知道了 – EnterJQ 2013-02-12 04:47:54