简体   繁体   English

有什么方法可以插入我在Codepen上发现的某些效果而不更改以前的工作吗?

[英]Is there any way to insert some effects I found on codepen without altering my previous work?

I want to include some code I found on code pen but when I insert it in my own code, everything gets messed up since the aforementioned effect needs some CSS which clashes with my own. 我想包含一些我在代码笔上找到的代码,但是当我将其插入自己的代码中时,一切都会搞砸了,因为上述效果需要一些与我自己的CSS冲突的CSS。 Is there an easy way to insert the code into my own and apply its own CSS only to that part of the code? 有没有简单的方法可以将代码插入我自己的代码,并仅将自己的CSS应用于代码的那一部分? It's virtually impossible to modify the pen's css because is really big. 实际上,修改笔的CSS几乎是不可能的,因为它很大。 It would be great to find a way for that code to use only its own CSS while the rest of the page uses the one I wrote. 最好找到一种方法,使该代码仅使用其自己的CSS,而页面的其余部分使用我编写的CSS。

Thanks in advance. 提前致谢。

Create parent div for the code and give some class name to that div of your code. 为代码创建父div,并为代码的该div指定一些名。 Then to all CSS properties of the code apply that class name as prefix and Bingo !! 然后对代码的所有CSS属性应用该类名作为前缀和Bingo! You're done with overriding error. 您已经完成了覆盖错误。

NOTE : While following above process create class for the code whichever contains less code **(Codepen or your original code)**.

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

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