Adding images

Let's add an image to our home page.

  • Open the IDE and navigate into /main.

  • Find an image on your computer that you can upload. (Here is one.)

  • In the IDE, turn on the toolchain (on/off button on the top left) and upload the image by dropping it onto the IDE, positioning it after the /main/content file like so:

     

 

image-file-upload.png

 

It's almost perfect, but there is no space between the text and the image, let's fix that.

 

image-upload-success.png

 

It's almost perfect, but there is no space between the text and the image, let's fix that.

 

image-no-spacing.png

 

In the /main/content file's body, change the last <div class="t1 mt-16"> to <div class="t1 mt-16 mb-16">. The mb-16 adds 16px margin at the bottom of the text.

 

add-bottom-margins.png

 

Now it should look just right.

 

image-spacing-added.png

 

But how come the image is displayed?

If you check the file type of the image, it will be image-1. This is a built-in app that handles displaying images, unless you want to take control and do it yourself.

Besides that, it is your code, the f.query('main/*').inline() that finds the image and then inlines it.

 

inline-contents-are-ordered.png

 

If you drag the image before the content file in the IDE, their order will change on your website too. To achieve this, files on Boomla are ordered.

 

switch-content-file-order.png

 

This concludes our journey on creating a little multi-page website on Boomla by writing code. If you are interested, I'm happy to add many more intros like this one, including on how to write dynamic applications. Let me know what you wanted to learn!