一个 div 的 CSS 重置

发布于 2024-09-16 23:27:08 字数 397 浏览 4 评论 0原文

我正在尝试在我的网站上创建一个 div,它应该像 Ebay 上的描述一样工作,其中主网站的所有 css 样式都被剥离,然后 div 中的任何样式就是 div 的样式(如果你能理解)我的意思是)。我一直在尝试使用重置样式表,但我的问题是重置也会重置我放入 div 中的任何内容。例如以下内容:

<div class="reset_this_div">
  <font color="red">This is reformatted</font>
</div>

应重置 div 中的 css,然后使用字体标签将文本“This is reformatted”设为红色。然而,重置似乎覆盖了字体标签,文本只是保持黑色。有谁知道我该如何解决这个问题?

谢谢!

I am trying to create a div on my site that is supposed to work like the descriptions on Ebay where all the css styles of the main site are stripped off and then whatever styles are in the div are what style the div (if you can understand what I mean). I've been trying to use a reset stylesheet, but my problem is that the reset is also resetting anything I put into the div. For example the following:

<div class="reset_this_div">
  <font color="red">This is reformatted</font>
</div>

should reset the css in the div, then make the text "This is reformatted" red with the font tag. However, the reset seems to be overriding the font tag and the text just stays black. Does anyone know how I can fix this?

Thanks!

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

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

发布评论

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

评论(1

甜味超标? 2024-09-23 23:27:08

您是否考虑过在另一个 div 中使用一个 div 而不是使用标签?像这样的:

<div class="reset_this_div">
  <div style="color: red !important;">This is reformatted</div>
</div>

问候

Have you considered using one div inside another instead of using the tag?. Something like this:

<div class="reset_this_div">
  <div style="color: red !important;">This is reformatted</div>
</div>

Regards

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