简体   繁体   English

改变<div></div>内联块不起作用(包括 repl.it)

[英]Changing <div></div> to inline-block doesn't work (repl.it included)

I can´t seem to be able to change the div element to an inline block.我似乎无法将 div 元素更改为内联块。 I really need help with this.我真的需要帮助。 Here is my repl.it: https://repl.it/repls/AwareContentTechnician这是我的repl.it:https://repl.it/repls/AwareContentTechnician

In the example you posted there are no elements with the class "crackerImage", if you want the div to be inline-block you have to add class="crackerImage" to the divs you want to be inline-block.在您发布的示例中,没有带有 class “crackerImage”的元素,如果您希望 div 成为内联块,则必须将class="crackerImage"添加到要成为内联块的 div 中。

And by the way you should never ever use the same id for more than one element in the html for a lot of reason like google will poorly rank you site, the browser will complain and so on...顺便说一句,你永远不应该对 html 中的一个以上元素使用相同的 id,原因有很多,比如谷歌会对你的网站进行不良排名,浏览器会抱怨等等......

this is an example这是一个例子

<div class="crackerImage">
    <img data-id="cracker" src="...">

And also be careful to put the = when you add attributes in html, as you can see they are missing for the onclick attributes of the buttons当您在 html 中添加属性时,还要小心放置= ,因为您可以看到按钮的onclick属性缺少它们

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM