为什么当 fieldset 内的 div 向左浮动时,它实际上向右浮动?

发布于 2024-10-25 05:54:48 字数 299 浏览 5 评论 0原文

这是 html:

<fieldset>
   <div>
   </div>
</fieldset>

这是 css:

fieldset
{
  float:  left;
  width:  200px;
}
   fieldset > div
   {
      float:  left;
      width:  100px;
   }

由于某种原因,div 似乎向右浮动,为什么呢?

here is the html:

<fieldset>
   <div>
   </div>
</fieldset>

here is the css:

fieldset
{
  float:  left;
  width:  200px;
}
   fieldset > div
   {
      float:  left;
      width:  100px;
   }

and for some reason the div appears to be floating right, why is that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪#恶を代价 2024-11-01 05:54:48

它实际上对我来说效果很好。它向左浮动,而不是向右浮动。
这是我尝试过的事情,
Index.html

<html>
<head>
<title></title>
<LINK REL=StyleSheet HREF="index1.css" TYPE="text/css" MEDIA=screen>
</head>
<body>
<fieldset>
<div> </div>
</fieldset>
</body>
</html>  

和index1.css

fieldset
{
  float:  left;
  width:  200px;
}
fieldset > div
{
     float:  left;
     width:  100px;
  } 

以及字段集位于左侧。

看看这里:浮动 div 到字段集中的左侧

It actually works fine with me. It floats to the left, instead to the right.
Here's something that I tried,
Index.html

<html>
<head>
<title></title>
<LINK REL=StyleSheet HREF="index1.css" TYPE="text/css" MEDIA=screen>
</head>
<body>
<fieldset>
<div> </div>
</fieldset>
</body>
</html>  

and index1.css

fieldset
{
  float:  left;
  width:  200px;
}
fieldset > div
{
     float:  left;
     width:  100px;
  } 

and the fieldset is on the left.

Have a look here : Floating div to left inside the fieldset

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文