Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 为父元素添加样式_Css_Typescript_Google Maps Markers_Openinfowindowhtml - Fatal编程技术网

Css 为父元素添加样式

Css 为父元素添加样式,css,typescript,google-maps-markers,openinfowindowhtml,Css,Typescript,Google Maps Markers,Openinfowindowhtml,我想为子类的父元素编写样式。gm style.gm style iw。我也使用了:家长,但它不起作用。这两个类动态地出现在DOM中 我被困在这里了。请帮助。使用纯CSS是不可能的,您可以使用Javascript,但没有使用纯CSS的选项,抱歉 :parent是一个概念,描述了它在实现时的样子 编辑-JS let a = document.querySelectorAll('.gm-style'); for(let i = 0; i < a.length; i++) { a[i].p

我想为子类的父元素编写样式。gm style.gm style iw。我也使用了:家长,但它不起作用。这两个类动态地出现在DOM中


我被困在这里了。请帮助。

使用纯CSS是不可能的,您可以使用Javascript,但没有使用纯CSS的选项,抱歉

:parent
是一个概念,描述了它在实现时的样子

编辑-JS

let a = document.querySelectorAll('.gm-style');
for(let i = 0; i < a.length; i++) {
    a[i].parentNode.classList.add('');
}
let a=document.querySelectorAll('.gm-style');
for(设i=0;i

即使在IE11中也应该可以这样做,只需将要添加到父类的类插入到它应该获得的样式中。

我使用的是angular 5和so typescript。那怎么办呢?不,不行