Table of Contents | ||||
---|---|---|---|---|
|
...
This combined query will generate our example HTML code and return it as value in the Html
variable.
img tag
div tag
...
The div
tag is a versatile block element that can be used to organize and style HTML content in various ways. In the html.pl
file provided to you we have defined a div/4
predicate div(Content, Class, Style, Html)
that facilitates the generation of div
elements with class
and style
attributes that you can set. The code that will be generated looks simply like a basic div element without any content yet:
Code Block |
---|
<div class="CLASS" style="STYLE">CONTENT</div> |
In this code template, CLASS
refers to the value of the Class
variable, STYLE
to the value of the Style
variable, and CONTENT
to the value of the Content
variable in the div(Content, Class, Style, Html)
query. All of these variables need to be fully instantiated to generate HTML code that is returned in the output argument Html
.
span tag
The span
tag is an inline element that is commonly used to style HTML content. We have added a span/3
predicate span(Content, Style, Html)
that just does that and nothing else. An example of a span tag that can be useful is to style the content and change the font family that is used within some HTML content:
...
By means of these and generate with the rule. The HTML code is represented in Bootstrap format, which is also clearly illustrated by examples below or on Bootstrap's documentation website (Bootstrap Documentation).
Note |
---|
Prolog Advice: To manipulate strings and atoms in Prolog it is useful to look at documentation of the following built-in functions: atomic_list_concat, atom_concat, string_concat, append, and maplist here: https://www.swi-prolog.org/. The predicate applyTemplate is a defined predicate that will be explained below. |
...