定义css样式div元素

时间:2016-12-21 06:46:34

标签: javascript css styles

我使用javascript,我有以下元素。我想应用CSS样式来改变高度:100px的元素iframe

<div tabindex="-1" 
class="mce-edit-area mce-container mce-panel mce-stack-layout-item"
 id="mceu_21" role="group" style="border-width: 1px 0px 0px;" hidefocus="1">
 <iframe title="Área de texto enriquecido. 
 Pulse ALT-F9 para el menu. Pulse ALT-F10 para la barra de herramientas.
 Pulse ALT-0 para ayuda" id="text1_ifr" src='javascript:""' 
 frameborder="0" style="width: 100%; height: 100px; display: block;" allowtransparency="true">
</iframe></div>

如何定义CSS样式?

2 个答案:

答案 0 :(得分:0)

首先将一个类添加到iframe

<iframe class="height-100"></iframe>

在CSS中提供你的造型,

iframe .height-100 {
  height: 100px;
}

仅作为最后手段使用height: 100px !important

更新:

您已经为iframe提供了样式

style="width: 100%; height: 100px;"
应该有效的

,使用element select并检查它是否被其他内容覆盖。

答案 1 :(得分:-2)

在head标签中定义样式元素

<style>
iframe {
    width: 100px !important;
}
</style>
相关问题