Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

1. Fundamental Syntax and Semantics > 1.4. Optimizing <script>s and <link>s

1.4. Optimizing <script>s and <link>s

Problem

You want to reference JavaScripts and include links to external CSS files in your web page as simply as possible.

Solution

Include script and link declarations, but without the type attribute:

<link rel="stylesheet" href="styles.css" />
<script src="scripts.js"></script>

Discussion

HTML5 requires only the minimum amount of information needed for user agents. In previous versions of HTML, both CSS links and scripts required the type attribute to indicate the language. If you forgot to include type, though, most browsers assumed the correct value.

HTML5 makes type officially optional, but still validates older documents that do include the attribute. This makes sense, as there is really only one standard scripting language and only one styling language for the Web in use today.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint