【发布时间】:2010-10-16 02:45:37
【问题描述】:
我希望在我的页面上的标题 div 中生成以下布局,仅使用 CSS
+-----------+ + + + 图片 + 标题文本 一些文本在右侧对齐 + + +-----------+我无法对齐右侧的文本。它保持立即对齐到标题文本下方的右侧和一行,就像这样
+-----------+ + + + 图片 + 标题文字 + + 一些文字在右边对齐 +-----------+这是我当前的标记。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<style type="text/css">
#header, #footer { padding: 0.3em 0; border-bottom: 1px solid; }
#header img { display: inline;}
#header h1 { display: inline; margin: 0px; padding: 0px;
vertical-align: 50%; position: left;}
#login-status { margin: 0px; padding: 0px;
display: inline;text-align: right; position: right;}
</style>
<title>Models</title>
</head>
<body>
<div id="header">
<img alt="Logo" height="110" width="276"
src="http://www.google.co.uk/intl/en_uk/images/logo.gif" width="276" />
<h1>Models</h1>
<p id="login-status">You are currently logged in as steve</p>
</div> <!-- end of header -->
</body>
</html>
我曾预计内联样式不会在 h1 元素之后导致换行,但事实并非如此。谁能建议我做错了什么?
【问题讨论】:
标签: css