2013-02-06 28 views
0

我使用邊距來定位我的Web應用程序中使用Google Apps腳本UiInstance創建的元素(並在元素之間添加空間)。如何在Google Apps腳本用戶界面上正確應用Firefox的邊距

邊距在Firefox或Opera中未正確應用。它們正在Chrome和Internet Explorer中使用,所以我覺得代碼是正確的。

這裏是一個例子,我有published here

function doGet() { 
    var app = UiApp.createApplication(); 
    app.add(app.createLabel("Some Text").setStyleAttribute("margin-left","500px").setStyleAttribute("margin-top","25px")); 
    return app; 
} 

任何人都可以解釋爲什麼會發生這種情況?這是一個錯誤,還是這種不好的做法,我應該做點別的?

注意:使用Firefox檢查器,我發現沒有任何內容會顯示嘗試使用邊距。

回答

1

語法問題,請嘗試像這樣

function doGet() { 
    var app = UiApp.createApplication().setStandardsMode(false); 
    app.add(app.createLabel("Some Text").setStyleAttribute("marginLeft","500px").setStyleAttribute("marginTop","25px")); 
    return app; 
} 

或類似這樣的

function doGet() { 
    var app = UiApp.createApplication().setStandardsMode(false); 
    app.add(app.createLabel("Some Text").setStyleAttributes({marginLeft :"500px",marginTop :"25px"})); 
    return app; 
} 
+0

謝謝。這固定了它。 CamelCase的利潤似乎有效,而虛線的利潤則沒有。奇怪,但我想這就是它的樣子。 –

+0

我讀過文檔中的某處,但現在我只是找不到它在哪裏(如果我找到它,我會將它作爲參考發佈) –

+0

剛發現它[在camelCase中的CSS屬性。 (「fontSize」,而不是「font-size」)](https://developers.google.com/apps-script/class_textbox?hl=zh-CN)。 –

相關問題