img 浮点数:右; Div 溢出:自动

问题描述

我想用右边框的 img 装饰文本, 这是我的代码

<img width="276" height="183" style="float:right; margin: 0em 0em 0.5em 0em;" src="myimg.jpg">
</img>
<div style="overflow:auto; widt:300em; margin:0em 0em 0.5em 0em;">
 <h3>MyTitle</h3>
 <p>MyText</p>
 <p>MyText2</p>
 <p>MyText3</p>
</div>

img 按预期出现在右边框处。唉,div 出现在 img 之外,但在左边框处。 怎么了?我应该在 div 中的 widt-property 像在自己的声明中的 img 一样吗? 从 img 开始是否正确?我这么认为是因为浮点属性是第一位的,HTML 编译器按照有意义的顺序获取这些属性。 htms

解决方法

您的代码正确且 div 的行为正确。

但是 div 没有出现在图像之外,而是出现在图像的左侧。

对您来说,它似乎超出了div的范围,因为您给了 <img width="276" height="183" style="float:right; margin: 0em 0em 0.5em 0em;" src="https://dummyimage.com/200x200/000/fff"> <div style="overflow:auto; width:350px; margin:0em 0em 0.5em 0em; border: 1px dotted red"> <h3>MyTitle</h3> <p><b>Make example full width to see how the div is place at the right side of the image.</b></p> <p>Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie,musica,sport etc,litot Europa usa li sam vocabular.</p> <p>Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie,litot Europa usa li sam vocabular.</p> </div>一个极大的智慧(超过 4000 像素)。解释:如果一个元素的宽度大于空间,它会跳转到浮动元素之外的下一个“行/空间”。

我准备了代码,所以你可以看到它是如何工作的。只需更改浏览器窗口中的 with,您就可以看到 div 在左侧的位置以及它何时/如何跳到下方。

如果图片开头无法回答就准备好的信息。这取决于您希望如何布局元素组。

java.lang.Exception: org.apache.ws.security.WSSecurityException: Signature creation failed (Cannot setup signature data structure)
  at DocumentSigner.signDocument(DocumentSigner.java:76)
  at DocumentSigner.main(DocumentSigner.java:165)
Caused by: org.apache.ws.security.WSSecurityException: Signature creation failed (Cannot setup signature data structure)
  at org.apache.ws.security.message.WSSecSignatureBase.addReferencesToSign(WSSecSignatureBase.java:191)
  at org.apache.ws.security.message.WSSecSignature.addReferencesToSign(WSSecSignature.java:413)
  at org.apache.ws.security.message.WSSecSignature.build(WSSecSignature.java:385)
  at DocumentSigner.signDocument(DocumentSigner.java:74)
  ... 1 more
Caused by: java.lang.NullPointerException
  at org.apache.ws.security.message.DOMCallbackLookup.getElements(DOMCallbackLookup.java:106)
  at org.apache.ws.security.util.WSSecurityUtil.findElements(WSSecurityUtil.java:267)
  at org.apache.ws.security.message.WSSecSignatureBase.addReferencesToSign(WSSecSignatureBase.java:156)
  ... 4 more