Data URI
We have already used on several occasions Data URI (Uniform resource identifier) throughout this book, but never got into details on what can we use it for as well as what are the limitations. Data URI are often referred to as Data URL (Uniform Resource Locator) though technically speaking they don't actually locate anything from a remote site.
In this example, we will use different media types and check the size constraints.
Getting ready
We will only need browser and some sample text files for this example. The files can be downloaded as part of the files
folder in the example files.
How to do it...
In order to see some of the options available we will create a simple HTML file with few different use scenarios:
The
head
section will include theexample.css
file:<head> <title>Data URI example</title> <link rel="stylesheet" type="text/css" href="example.css"> </head>
In the
body
section we add adiv
element that will serve as a container for the CSS image...