I am creating a simple app with an image. I create the app like so:
function createApplication(){
var app = UiApp.createApplication().setTitle("My Simple App");
mainImage = app.createImage("URL TO IMAGE");
app.add(mainImage);
return(app);
}
This puts the image to the top left of the screen. Can someone show me how to center the image ?
Many thanks
You can use
setStyleAttribute()and refer to some CSS documentationtry it like this for example (I’m really not an expert in CSS so don’t blame me if it is inelegant 😉
Note : You can also position your image using PX(pixels) instead of % and, as you noticed, I tested this in a spreadsheet UI.
EDIT : and here is a version using pixels and Bryan’s suggestion for CSS styling, more compact and with a syntax that approaches the original CSS method (thx again) :