我有一个调用来将HTML/CSS添加到现有的页面:
let div = document.createElement('div');
div.style.zIndex = 9999999;
div.innerHTML = str; // some pre-defined HTML string
document.body.insertBefore(div, document.body.firstChild);
我正在创建一个帮助开发人员的Chrome扩展。正在发生的事情是,上面的HTML正在从开发人员的页面继承现有的CSS。我希望上述HTML的样式独立于开发人员页面上的CSS
在这段代码中,我有一个类似下面这样的段落
<p class="special">
This is just a test. <em>what color here</em> inheritance work
</p>
我想知道为什么字符串"what color here“不从父p元素获取颜色。我的意思是,特殊类的特异值是10,而像em这样的类型的特异值是1,所以这里10大于1。
所以我的意思是颜色应该取自选择器.special
这是标记和css
<!DOCTYPE html>
<html>
图1.图像以黑色字母显示模拟器的标题。在图像的下一节中,它将显示CSS中配置的内容,以及它在检查器中的应用程序。我试着在检查器中分配其他UIID,它会改变除了字母的颜色以外的所有内容。
我的CSS映射代码。
public class Tarifa extends Form {
Idioma idioma;
public Tarifa() {
this.setLayout(new BorderLayout());
this.setScrollable(true);
Usuario iU = Usuario.getInstancia();
idioma
在片段中,第三个h2不应该受到css的影响,那么为什么呢?
.a > div { color: blue; text-align: center; }
<div class="a">
<h2>Title</h2>
<div>
<h2>this shoud be center and blue</h2>
<div>
<h2>this should Not be center or blue</h2&