Base tag

When viewing SVG graphics in a browser, it's important to embed an <svg> tag inside an HTML page. Let's create an index.html file and add the following to it:

<!DOCTYPE html><html lang="en" dir="ltr">    <head>    </head>    <body>        <svg></svg>    </body></html>

Now start a web browser and open that file (usually, File | Open File). For this book, it is recommended that the reader use Google Chrome, but in development and production, any browser will do.  If we inspect our HTML in the Elements tab of Chrome's Dev Tools (View | Developer | Developer Tools), we'll see the following:

Get D3.js Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.