29.07.2016 Views

front-end-developer_1_

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Front-End-Developer - Level 1<br />

23.Styling text<br />

Embedded Video: https://www.youtube.com/watch?v=_M7W89FS9Bw?rel=0<br />

I'll be the first to admit it: the web pages we've made so far are pretty ugly. Let's learn our<br />

first CSS, which stands for Cascading Style Sheets. They're called cascading because<br />

often a single element on a webpage will have multiple sources that style it, and CSS<br />

resolves those differences to create the style you see on the screen. But we'll get into more<br />

of that later.<br />

Side note: if trying to make something look pretty is your idea of an awful time, don't worry:<br />

this isn't a design course. We're going to learn enough about styling to get you to the point<br />

where you can apply styles that other people develop without having to do any design<br />

yourself. And if you love design and want to learn more, I'll point you in the right direction at<br />

the <strong>end</strong> of this section.<br />

Let's get going and make a folder called css and create a new file in it called styles.css .<br />

The first thing we need to do is to tell our HTML document to use this file for its CSS:<br />

favorite-things.html<br />

<br />

<br />

Michael's favorite things<br />

<br />

I'm leaving out everything above and below the tag for the sake of brevity.<br />

In our styles.css file, let's add our first bit of CSS:<br />

styles.css<br />

h1 {<br />

}<br />

color: blue;<br />

Now, if we refresh the page, our header is blue!<br />

What we just wrote is called a CSS rule. The h1 part is called a selector, because it<br />

selects the HTML elements that the rule applies to. The color is called a property, and<br />

then blue is called a value.<br />

Styling text<br />

35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!