Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical Web Development

You're reading from   Practical Web Development Learn CSS, JavaScript, PHP, and more with this vital guide to modern web development

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781782175919
Length 276 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Paul Wellens Paul Wellens
Author Profile Icon Paul Wellens
Paul Wellens
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. The World Wide Web FREE CHAPTER 2. HTML 3. CSS 4. JavaScript 5. PHP 6. PHP and MySQL 7. jQuery 8. Ajax 9. The History API – Not Forgetting Where We Are 10. XML and JSON 11. MongoDB 12. Mobile First, Responsive Design with Progressive Enhancement 13. Foundation – A Responsive CSS/JavaScript Framework 14. Node.js A. Bootstrap – An Alternative to Foundation Index

Adding styles to our documents

So how do the CSS rules become part of our document? There are three ways:

  • External style sheets
  • Internal CSS
  • Inline styles

External style sheets

This is the recommended way to add CSS to your site. It should be your goal for all style sheets of the production version of your site to be external. Simply add a line to the <head> section of your site, which should look like the following:

<link rel="stylesheet" type="text/css" href="css/style.css">

<link> is an HTML element we had not yet introduced. Its attributes are listed below:

  • rel, to indicate the relationship between the HTML document and the linked file.
  • type specifies the MIME type of the document so the browser knows how to load it.
  • href is used to specify the location of the file. You may expect a src attribute here, like is used for <img> tags, but the attribute to specify the file name in a <link> element is href. For the file name, we recommend...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime