2016-12-21 80 views
1

我使用javascript,我有以下元素。我想應用CSS樣式來更改高度:100px元素iframe定義css風格div元素

<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樣式?

+0

你想改變iFrame的高度,只是尋找命令做到這一點與JavaScript? –

+0

您是否嘗試使用屬性height =「100」? –

+0

我想申請一個CSS樣式 – user3712581

回答

-2

在頭標記

<style> 
iframe { 
    width: 100px !important; 
} 
</style> 
+0

如何定義元素id =「mceu_21」的樣式? – user3712581

+0

@ user3712581你將不得不在#前面使用#,檢查[css selectors](http://www.w3schools.com/cssref/css_selectors.asp) –

0

定義樣式元素的類添加到IFRAME第一

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

在CSS提供您的造型,

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

使用height: 100px !important只能作爲最後的採取。

更新:

您已經提供造型到iframe

style="width: 100%; height: 100px;" 

認爲應該有工作,使用element select,檢查其得到由別的東西覆蓋。