我試圖使圖像一路向右一個DIV,但它不是發生了什麼:\填充上浮動不爲0:右
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style>* { margin:0;padding:0; }
#login {
background:red;
width:200px;
xpadding:5px;
}
#login a, #login a:visited {
color:blue;
text-decoration:none;
font:12px verdana;
}
</style>
<title>Untitled 1</title>
</head>
<body>
<div id="login"><div style="float:right;margin-right:5px;"><img src="https://si0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png" /> </div>
<div style="float:right;color:red;text-align:right;"><a href="#">@Testing</a><br /><a href="?wipe=1">Logout</a></div>
<div style="clear:both;"></div></div>
</body>
</html>
試穿的說... http://htmledit.squarefree.com/這一點,你當邊框右邊應該浮動時,會看到紅色仍然可見。
我不正好得到你所需要的,這裏我想代碼不正是它應該做的。一切都在'登錄'div裏面,而div是200px,所以一切都在200px寬度內。 'float:right'已經將它浮動到div的最右邊部分 – Balanivash
remove margin-right:5px; –