0
<html>
<head>
<style type="text/css">
div, p {border: 1px dashed;}
</style>
</head>
<body>
<!-- Why must the text that's intended to be right-justified *PRECEED*
the text that is to be left-justified? It "feels" like the syntax should
simply read from top to bottom:
<div>
"Put some text here"
"Then put some text here, but align it right"
</div>
Instead, this seems to work:
<div>
"The right-justified text has to go first"
"Then we code the 'normal' left-justified text"
</div>
I see how to 'make it work', but I'm curious as to the logic behind this
seemingly 'backwards' syntax. What am I misunderstanding?
-->
<div>
<!-- Does NOT work as intended -->
<div>
<p>I am on the Left</p>
</div>
<div style="float: right;">
<p>I am on the RIGHT, but I don't align</p>
</div>
<br />
<br />
<br />
<!-- Works as intended -->
<div style="float: right;">
<p >I am on the RIGHT, and I mostly align</p>
</div>
<div>
<p class="">I am on the Left</p>
</div>
</div>
</body>
</html>
Hi Richard。是的,你的回答确实有帮助。我错过了文档流如何呈现的概念。您的回复引起我以不同的方式回答这个问题,其中以下站点为我提供了另一个CSS难题:http://www.mako4css.com/TPos.htm和http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/ – Andrew
很高兴听到它,@Andrew。祝你好运,继续网页设计! – Richard