SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
Beginner CSS Tutorial: Text Selectors                                                                       1




I. SAVING YOUR HTML FILE AND GETTING ACQUAINTED WITH TEXT SELECTORS

1. Make a folder on your desktop. Call it “CSS_tutorial_1”

2. Create a new file in Dreamweaver. Select:

          - blank page
          - Page type: html
          - Layout: <none>
          - click “create”

We do not want to use a template for this because we are building the CSS from scratch.

3. Go to “File” > “Save as” and name your Dreamweaver document “text_selectors_1.html”. Save it in
   your “CSS_tutorial_1” folder on your desktop.

4. Look at the upper left-hand corner of your screen. There are three buttons:

“Code”, “Split”, and “Design”. Click on “Split”.




5. Your workspace is now split in half. The top part is the code area, and it already has some code
   in it. The bottom area is blank; this is the design area. We will be working back and forth between
   the two.

6. Take a look at the code. It should read like this:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xht-
ml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8” />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>



What is this?? This is the doctype (“document type declaration”).

It tells your website to recognize the browser so that your layout is presented correctly. It informs the
validator which version of (X)HTML you’re using, and must appear at the very top of every web page.
DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate
without them.
There are different types of doctypes; however we won’t get too deep into this right now. If you’re inter-   2

ested in learning more about them go to:

          http://www.alistapart.com/articles/doctype/

The most important thing to know is that you absolutely need this code—do not delete it!



7. Look at line 5 of the code:
          <title>Untitled Document</title>
This is where you name your document. This has nothing to do with the name you save it with—what
you type in here is what shows up at the top of the browser window. For now, type in:
          <title>Font Tags 1 :: GD4</title>
You can also name your file here:




Notice the title shows up at the top of the window next to “Title” and is also reflected in the code.



I want you to be comfortable going back and forth between your layout mode and code mode. The
more you understand what is happening the code, the more likely you will be able to think in terms of
your markup for layout.



8. Look at line 8 in your code:
<body>



Type in the following so that after the body tag your code looks like this:
<body>

<h1> this is a headline      1 tag </h1>
<h2> this is a headline      2 tag </h2>
<h3> this is a headline      3 tag </h3>
<p> this is a paragraph      tag </p>

<a href=”#”> this is a link </a>

</body>
</html>
9. Click “refresh” in the CSS Styles panel (top right of the Dreamweaver interface). Now look below          3

   your code in the design window. It should look like this:




You just wrote your first lines of code! Dreamweaver automatically defaults these “styles” if you define
your text as an h1, h2, p... and so on. Lets define some rules for these tags so we’re not limited to this
font choice and color.



II. SAVING A CSS FILE AND DEFINING RULES

1. Look at your screen. In the upper right-hand corner, there should be a panel called “CSS Styles”. It
   looks like this:

                                                     In the upper right-most corner of that panel, click
                                                     and hold on this icon.

                                                     And drag down to “new”. Now, you should get a
                                                     window that looks like this:
2. You are adding a new CSS rule to your document. Do the following:                                           4


         - Selector Type: select “Tag” (don’t worry about “classes” or “IDs”—we’ll cover these later).

         - Tag: click and hold the two arrows to the right of the field. Drag down to select “h1”.
           You are defining the “h1” (headline 1) tag.

         - Define in: select “(New Style Sheet File)”

         - click “OK”



3. Dreamweaver is going to ask you to save your styles before defining any rules. Think of it this way:

         CSS is a separate file from your html file. Your html file only holds the specific content for
         your web page (such as text and images), whereas the CSS file defines all the RULES for all
         your site’s pages (the font sizes, color, and layout).

         Your CSS file needs to be saved in the same folder as your html file in order for your html
         file to know where to get it’s “rules” from.

         Here’s another way to think of CSS: if you have a seven page website, you only need one
         CSS file to govern all the pages. It’s like using style sheets in InDesign: one set of rules govern
         all the pages of a book. Get it?

Now, let’s save your CSS file before defining any rules. Name your CSS file: “text_selectors_1.css” and
save it in your “CSS_tutorial_1” folder. You will only have to do this once. The next time you want to
add a rule, it will be much easier.



4. Once your “text_selectors_1.css” is saved, a window should automatically pop up that looks like this:
Dreamweaver hasn’t forgotten that you originally wanted to define your <h1> tag. The window                      5

automatically opens up in the “Type” category. Do the following:

         - Font: select “Arial, Helvetica, sans-serif”

         - Size: select 24 pixels

         - Decoration: select “none” (this is so that if you decide to make it a link later on it won’t put an
           ugly underline under your headline)

         - Color: key in: ff7d00

Now look at what happened to your text! Notice that the code above has stayed exactly the same... but
your html files recognizes the rule you just made for your <h1> tag.




8. Let’s edit the <h1> tag a little bit more so you can get more comfortable with the CSS interface.
   Make sure that your <h1> tag is selected (highlighted) at the top of your CSS panel. If it isn’t, just
   click on it once. Below, look for “Properties for h1”. It looks like this:
In the properties window, there are three icons in the lower right-hand corner:                              6




If you rollover each one and hover for a while, you’ll see each represents the following:

         = “attach style sheet”

         = “new CSS rule”

         = “edit style”

         = “delete CSS rule”

Click on the pencil icon (“edit style”). The window for “CSS Rule Definition for h1” will pop-up. You
used this window before when we initially set up the rules for h1.



9. Look at the list to the left, under “Category”. These are all the different rules you can set for your
   font tags. Let’s modify our headline a little: (you can click “apply” in the lower right to preview the
   changes...)

         Category: Type
                 - Size: 20
                 - Case: uppercase
                 - Color: #333333

         Category: Background
                 - Background Color: #99CC00

         Category: Block
                 - Letter Spacing: 1 pixel
                 - Text Align: center

         Category: Box
                 - Width: Auto
                 - Height: 30
                 - Padding: Top: 8 pixels

         Category: Border
                 - Top: dotted, 1 pixel, Color #333333
                 - Right: dotted, 1 pixel, Color #333333
                 - Bottom: dotted, 1 pixel, Color #333333
                 - Left: dotted, 1 pixel, Color #333333
Click “OK”. Your <h1> should now look like this:                                                            7




10. Now, let’s look at your CSS document to see how these rules translate to code. At the top of your
    Dreamweaver file, there should be two tabs; “text_selectors_1.html” and “text_selectors_1.css”. Click
    on “text_selectors_1.css” to see your CSS document. Your rules should look something like this:
@charset “UTF-8”;
h1 {
       font-family: Arial, Helvetica, sans-serif;
       font-size: 20px;
       color: #333333;
       text-align: center;
       letter-spacing: 1px;
       text-transform: uppercase;
       background-color: #99CC00;
       height: 30px;
       width: auto;
       padding-top: 8px;
       border-bottom-width: 1px;
       border-bottom-style: dotted;
       border-bottom-color: #333333;
       border-top-width: 1px;
       border-top-style: dotted;
       border-top-color: #333333;
       border-right-width: 1px;
       border-left-width: 1px;
       border-right-style: dotted;
       border-left-style: dotted;
       border-right-color: #333333;
       border-left-color: #333333;
}



Take a closer look at all the “rules”. If you read them carefully, they make sense.

Important things to note:
       - there is a “;” after each line
       - colors are always preceded by the “#” sign
       - “width: auto;” (line 11) means that the box behind the title will scale and shrink to the
         browser size (we will test this).
III. DEFINING RULES FOR ALL YOUR TEXT                                                                  8


1. In the CSS panel, select “text_selectors_1.css” and in the properties window click “New CSS Rule”
   (page with “+” icon)

2. In “New CSS Rule” pop-up window select the following:

         - Selector Type: select “Tag”
         - Tag: h2
         - Define in: “text_selectors_1.css”
         - click “ok”

3. Set up the following categories:
         Category: Type
                   - Font: Arial, Helvetica, sans-serif
                   - Size: 18
                   - Decoration: none
                   - Color: #666666

         Category: Block
                 - Text align: center

         Click “ok”



4. Repeat step 1, and for “New CSS Rule” pop-up window select the following:

         - Selector Type: select “Tag”
         - Tag: h3
         - Define in: “text_selectors_1.css”
         - click “ok”



5. Set up the following categories for h3:
         Category: Type
                   - Font: Georgia, Times New Roman, Times, serif
                   - Size: 12
                   - Decoration: none
                   - Case: Uppercase
                   - Color: #333333

         Category: Block
                 - Letter spacing: 2 pixels
                 - Text align: left
6. Now set up the following categories for p: (repeating steps 1 + 2)                                       9


         Category: Type
                 - Font: Verdana, Arial, Helvetica, sans-serif
                 - Size: 12
                 - Decoration: none
                 - Color: #666666

         Category: Block
                 - Text align: left



7. Now set up the following categories for your link (the tag is “a”): (repeating steps 1 + 2)

         Category: Type
                 - Font: Verdana, Arial, Helvetica, sans-serif
                 - Size: 12
                 - Decoration: none
                 - Color: #003366

         Category: Block
                 - Text align: left



8. Your page should look like this:




Notice the following:

         - None of your html has changed at all!
         - click on the “text_selectors_1.html” tab. Now look at your CSS code. It should look like this:
@charset “UTF-8”;                                                           10
h1 {
       font-family: Arial, Helvetica, sans-serif;
       font-size: 20px;
       color: #333333;
       text-align: center;
       letter-spacing: 1px;
       text-transform: uppercase;
       background-color: #99CC00;
       height: 30px;
       width: auto;
       padding-top: 8px;
       border-bottom-width: 1px;
       border-bottom-style: dotted;
       border-bottom-color: #333333;
       border-top-width: 1px;
       border-top-style: dotted;
       border-top-color: #333333;
       border-right-width: 1px;
       border-left-width: 1px;
       border-right-style: dotted;
       border-left-style: dotted;
       border-right-color: #333333;
       border-left-color: #333333;
}

h2 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 18px;
        color: #666666;
        text-align: center;
}

h3 {
        font-family: Georgia, “Times New Roman”, Times, serif;
        text-transform: uppercase;
        font-size: 12px;
        color: #333333;
        text-decoration: none;
        letter-spacing: 2px;
        text-align: left;
}

p {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #666666;
        text-decoration: none;
}

a {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #003366;
        text-decoration: none;
}



Notice how each tag’s rules are defined between the open and closed “{ }”
IV. TESTING YOUR WORK                                                                                    11


1. Click on the tab “text_selectors_1.html” to go back to your html file.

2. Now let’s look at your work in a browser. Look for the globe icon at the top of your Dreamweaver
window:




Click and hold on the globe icon, select “Preview in Firefox”. Dreamweaver might ask if you want to
save your file, save it if you haven’t already.

Your site should preview in Firefox. Notice how your h1 box scales and contracts if you play with your
browser window size. Also notice that your cursor changes over the link—however, the color of the
link does not. Next, we will define different states for hyperlinks.



V. DEFINING DIFFERENT STATES FOR HYPERLINKS USING THE PROPERTIES WINDOW

There’s two ways to define the different “states” of your links in Dreamweaver. I will show you both.

1. Look at the properties window at the bottom of your screen. It looks like this:




Click on the button that says “Page Properties.” It will open up a window that looks like this:
Look at the left-hand side of the window, under the word “category.” Click on the word “Links.”
2. Clicking on the word “Links” will bring you to this screen:                                                 12




Notice in the center of the screen you can select link color, visited, rollover, active.You can select
different colors for the active and inactive “states” for your links. You can also define if your links have
an underline or not.

                                                       This is one of the few times you will ever need to
                                                       use the property window, and in terms of CSS, this
                                                       is technically considered “cheating” as you have not
                                                       built in CSS rules for the different states of your
                                                       hyperlinks. Let’s look at what this did to your html
                                                       code:

                                                       Yuck! What is this? Dreamweaver hardcoded your
                                                       links into the html, messing up your nice clean
                                                       markup. Let’s move on to create those rules in CSS
                                                       in order to keep your html document as clean as
                                                       possible.



VI. DEFINING DIFFERENT STATES FOR HYPERLINKS IN YOUR CSS DOCUMENT

1. In Dreamweaver, look at the top of your window. Click over to the
CSS tab. Your workspace should now look like this:

Notice the highlighted section that reads as the following:
a {
         font-family: Verdana, Arial, Helvetica, sans-serif;
         font-size: 12px;
         color: #003366;
         text-decoration: none;
}

This defines how a link is displayed on your site. However, it DOES
NOT define the different states of your link (hover, active, visited) like
you can define in the properties window.
Underneath your “a” style, key in the following in the CSS document:                                             13


a:link {
       color: #003366;
       text-decoration: none;
}

a:hover {
       color: #0955ef;
       text-decoration: none;
}

a:visited {
       color: #9bef09;
       text-decoration: none;
}

Notice that the above rules don’t include fonts, sizes, etc. This is because your “a” tag already defines
this... this is the beauty of Cascading Style sheets. It follows a hierarchy of rules.

Now, switch over to your Dreamweaver site “text_selectors_1.html”. Go into your code and manually
delete the following: (all the “stuff” that Dreamweaver added when you defined your rollover in the
properties window.) Be careful—only delete the code in between the gray arrows.

                                                          Test your site. You should now have the colors
                                                          you selected for the different states of your links.
                                                          If it doesn’t work, clear your cache and try it
                                                          again. If that doesn’t work, check to make sure
                                                          your code (in CSS) in keyed in correctly.

                                                          In the next tutorial, we will work with Class and
                                                          ID selectors.




Quick reference: Basic HTML Tags

Tag               Description
<html>            Defines an HTML document
<body>            Defines the document’s body
<h1> to <h6>      Defines headers 1 through 6
<p>               Defines a paragraph
<br>              Inserts a single line break
<hr>              Defines a horizontal rule
<a:link>
<a:hover>
<a:visited>       Defines link states
<!-->             Defines a comment

Contenu connexe

Tendances

HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)Daniel Friedman
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreRuss Weakley
 
World wide web with multimedia
World wide web with multimediaWorld wide web with multimedia
World wide web with multimediaAfaq Siddiqui
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media QueriesRuss Weakley
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2Shawn Calvert
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/jsKnoldus Inc.
 
Css for Development
Css for DevelopmentCss for Development
Css for Developmenttsengsite
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!Syahmi RH
 
Intro to CSS Selectors in Drupal
Intro to CSS Selectors in DrupalIntro to CSS Selectors in Drupal
Intro to CSS Selectors in Drupalcgmonroe
 
Web development (html)
Web development (html)Web development (html)
Web development (html)AliNaqvi131
 
[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 WorkshopChristopher Schmitt
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing worldRuss Weakley
 

Tendances (18)

HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)HTML/CSS Crash Course (april 4 2017)
HTML/CSS Crash Course (april 4 2017)
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
World wide web with multimedia
World wide web with multimediaWorld wide web with multimedia
World wide web with multimedia
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Css tutorial 2012
Css tutorial 2012Css tutorial 2012
Css tutorial 2012
 
Css for Development
Css for DevelopmentCss for Development
Css for Development
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
 
Web Layout
Web LayoutWeb Layout
Web Layout
 
Intro to CSS Selectors in Drupal
Intro to CSS Selectors in DrupalIntro to CSS Selectors in Drupal
Intro to CSS Selectors in Drupal
 
Web development (html)
Web development (html)Web development (html)
Web development (html)
 
Css
CssCss
Css
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 

En vedette

CSS入門 情報の形を視覚化する - 千葉商科大 Web表現
CSS入門 情報の形を視覚化する - 千葉商科大 Web表現CSS入門 情報の形を視覚化する - 千葉商科大 Web表現
CSS入門 情報の形を視覚化する - 千葉商科大 Web表現Atsushi Tadokoro
 
Katy Design Round-up
Katy Design Round-upKaty Design Round-up
Katy Design Round-upshernaz_rp
 
Making CSS and Firebug Your New Friends
Making CSS and Firebug Your New FriendsMaking CSS and Firebug Your New Friends
Making CSS and Firebug Your New Friendscdw9
 

En vedette (6)

CSS_tutorial_1
CSS_tutorial_1CSS_tutorial_1
CSS_tutorial_1
 
CSS入門 情報の形を視覚化する - 千葉商科大 Web表現
CSS入門 情報の形を視覚化する - 千葉商科大 Web表現CSS入門 情報の形を視覚化する - 千葉商科大 Web表現
CSS入門 情報の形を視覚化する - 千葉商科大 Web表現
 
Jesusthisislong
JesusthisislongJesusthisislong
Jesusthisislong
 
Katy Design Round-up
Katy Design Round-upKaty Design Round-up
Katy Design Round-up
 
HTML Bootcamp
HTML BootcampHTML Bootcamp
HTML Bootcamp
 
Making CSS and Firebug Your New Friends
Making CSS and Firebug Your New FriendsMaking CSS and Firebug Your New Friends
Making CSS and Firebug Your New Friends
 

Similaire à CSS_tutorial_1

Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.docbutest
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.docbutest
 
Learn CSS From Scratch
Learn CSS From ScratchLearn CSS From Scratch
Learn CSS From Scratchecobold
 
BasicCSSFlowTutorial
BasicCSSFlowTutorialBasicCSSFlowTutorial
BasicCSSFlowTutorialtutorialsruby
 
Customizing the look and-feel of DSpace
Customizing the look and-feel of DSpaceCustomizing the look and-feel of DSpace
Customizing the look and-feel of DSpaceBharat Chaudhari
 
ITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docx
ITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docxITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docx
ITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docxchristiandean12115
 
Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004
Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004
Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004brighteyes
 
GTU Web Designing Interview Questions And Answers for freshers
GTU Web Designing Interview Questions And Answers for freshersGTU Web Designing Interview Questions And Answers for freshers
GTU Web Designing Interview Questions And Answers for freshersTOPS Technologies
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architectureLasha Sumbadze
 
Thinkful - HTML/CSS Crash Course (May 4 2017)
Thinkful - HTML/CSS Crash Course (May 4 2017)Thinkful - HTML/CSS Crash Course (May 4 2017)
Thinkful - HTML/CSS Crash Course (May 4 2017)TJ Stalcup
 

Similaire à CSS_tutorial_1 (20)

CSS_tutorial_2
CSS_tutorial_2CSS_tutorial_2
CSS_tutorial_2
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Intermediate Web Design.doc
Intermediate Web Design.docIntermediate Web Design.doc
Intermediate Web Design.doc
 
Learn CSS From Scratch
Learn CSS From ScratchLearn CSS From Scratch
Learn CSS From Scratch
 
BasicCSSFlowTutorial
BasicCSSFlowTutorialBasicCSSFlowTutorial
BasicCSSFlowTutorial
 
Customizing the look and-feel of DSpace
Customizing the look and-feel of DSpaceCustomizing the look and-feel of DSpace
Customizing the look and-feel of DSpace
 
Css notes
Css notesCss notes
Css notes
 
Dreamweaver
DreamweaverDreamweaver
Dreamweaver
 
Dreamweaver
DreamweaverDreamweaver
Dreamweaver
 
Dreamweaver cs4
Dreamweaver cs4Dreamweaver cs4
Dreamweaver cs4
 
ITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docx
ITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docxITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docx
ITECH2106-6106 Lab01-HTML CSS Intro and Needs Analysis.pdf.docx
 
Css Basics
Css BasicsCss Basics
Css Basics
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004
Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004
Using Stylesheets To Design A Web Site In Dreamweaver Mx 2004
 
Css basics
Css basicsCss basics
Css basics
 
Css basics
Css basicsCss basics
Css basics
 
GTU Web Designing Interview Questions And Answers for freshers
GTU Web Designing Interview Questions And Answers for freshersGTU Web Designing Interview Questions And Answers for freshers
GTU Web Designing Interview Questions And Answers for freshers
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
Css methods architecture
Css methods architectureCss methods architecture
Css methods architecture
 
Thinkful - HTML/CSS Crash Course (May 4 2017)
Thinkful - HTML/CSS Crash Course (May 4 2017)Thinkful - HTML/CSS Crash Course (May 4 2017)
Thinkful - HTML/CSS Crash Course (May 4 2017)
 

Plus de tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

Plus de tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Dernier

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 

Dernier (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

CSS_tutorial_1

  • 1. Beginner CSS Tutorial: Text Selectors 1 I. SAVING YOUR HTML FILE AND GETTING ACQUAINTED WITH TEXT SELECTORS 1. Make a folder on your desktop. Call it “CSS_tutorial_1” 2. Create a new file in Dreamweaver. Select: - blank page - Page type: html - Layout: <none> - click “create” We do not want to use a template for this because we are building the CSS from scratch. 3. Go to “File” > “Save as” and name your Dreamweaver document “text_selectors_1.html”. Save it in your “CSS_tutorial_1” folder on your desktop. 4. Look at the upper left-hand corner of your screen. There are three buttons: “Code”, “Split”, and “Design”. Click on “Split”. 5. Your workspace is now split in half. The top part is the code area, and it already has some code in it. The bottom area is blank; this is the design area. We will be working back and forth between the two. 6. Take a look at the code. It should read like this: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xht- ml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8” /> <title>Untitled Document</title> </head> <body> </body> </html> What is this?? This is the doctype (“document type declaration”). It tells your website to recognize the browser so that your layout is presented correctly. It informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page. DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate without them.
  • 2. There are different types of doctypes; however we won’t get too deep into this right now. If you’re inter- 2 ested in learning more about them go to: http://www.alistapart.com/articles/doctype/ The most important thing to know is that you absolutely need this code—do not delete it! 7. Look at line 5 of the code: <title>Untitled Document</title> This is where you name your document. This has nothing to do with the name you save it with—what you type in here is what shows up at the top of the browser window. For now, type in: <title>Font Tags 1 :: GD4</title> You can also name your file here: Notice the title shows up at the top of the window next to “Title” and is also reflected in the code. I want you to be comfortable going back and forth between your layout mode and code mode. The more you understand what is happening the code, the more likely you will be able to think in terms of your markup for layout. 8. Look at line 8 in your code: <body> Type in the following so that after the body tag your code looks like this: <body> <h1> this is a headline 1 tag </h1> <h2> this is a headline 2 tag </h2> <h3> this is a headline 3 tag </h3> <p> this is a paragraph tag </p> <a href=”#”> this is a link </a> </body> </html>
  • 3. 9. Click “refresh” in the CSS Styles panel (top right of the Dreamweaver interface). Now look below 3 your code in the design window. It should look like this: You just wrote your first lines of code! Dreamweaver automatically defaults these “styles” if you define your text as an h1, h2, p... and so on. Lets define some rules for these tags so we’re not limited to this font choice and color. II. SAVING A CSS FILE AND DEFINING RULES 1. Look at your screen. In the upper right-hand corner, there should be a panel called “CSS Styles”. It looks like this: In the upper right-most corner of that panel, click and hold on this icon. And drag down to “new”. Now, you should get a window that looks like this:
  • 4. 2. You are adding a new CSS rule to your document. Do the following: 4 - Selector Type: select “Tag” (don’t worry about “classes” or “IDs”—we’ll cover these later). - Tag: click and hold the two arrows to the right of the field. Drag down to select “h1”. You are defining the “h1” (headline 1) tag. - Define in: select “(New Style Sheet File)” - click “OK” 3. Dreamweaver is going to ask you to save your styles before defining any rules. Think of it this way: CSS is a separate file from your html file. Your html file only holds the specific content for your web page (such as text and images), whereas the CSS file defines all the RULES for all your site’s pages (the font sizes, color, and layout). Your CSS file needs to be saved in the same folder as your html file in order for your html file to know where to get it’s “rules” from. Here’s another way to think of CSS: if you have a seven page website, you only need one CSS file to govern all the pages. It’s like using style sheets in InDesign: one set of rules govern all the pages of a book. Get it? Now, let’s save your CSS file before defining any rules. Name your CSS file: “text_selectors_1.css” and save it in your “CSS_tutorial_1” folder. You will only have to do this once. The next time you want to add a rule, it will be much easier. 4. Once your “text_selectors_1.css” is saved, a window should automatically pop up that looks like this:
  • 5. Dreamweaver hasn’t forgotten that you originally wanted to define your <h1> tag. The window 5 automatically opens up in the “Type” category. Do the following: - Font: select “Arial, Helvetica, sans-serif” - Size: select 24 pixels - Decoration: select “none” (this is so that if you decide to make it a link later on it won’t put an ugly underline under your headline) - Color: key in: ff7d00 Now look at what happened to your text! Notice that the code above has stayed exactly the same... but your html files recognizes the rule you just made for your <h1> tag. 8. Let’s edit the <h1> tag a little bit more so you can get more comfortable with the CSS interface. Make sure that your <h1> tag is selected (highlighted) at the top of your CSS panel. If it isn’t, just click on it once. Below, look for “Properties for h1”. It looks like this:
  • 6. In the properties window, there are three icons in the lower right-hand corner: 6 If you rollover each one and hover for a while, you’ll see each represents the following: = “attach style sheet” = “new CSS rule” = “edit style” = “delete CSS rule” Click on the pencil icon (“edit style”). The window for “CSS Rule Definition for h1” will pop-up. You used this window before when we initially set up the rules for h1. 9. Look at the list to the left, under “Category”. These are all the different rules you can set for your font tags. Let’s modify our headline a little: (you can click “apply” in the lower right to preview the changes...) Category: Type - Size: 20 - Case: uppercase - Color: #333333 Category: Background - Background Color: #99CC00 Category: Block - Letter Spacing: 1 pixel - Text Align: center Category: Box - Width: Auto - Height: 30 - Padding: Top: 8 pixels Category: Border - Top: dotted, 1 pixel, Color #333333 - Right: dotted, 1 pixel, Color #333333 - Bottom: dotted, 1 pixel, Color #333333 - Left: dotted, 1 pixel, Color #333333
  • 7. Click “OK”. Your <h1> should now look like this: 7 10. Now, let’s look at your CSS document to see how these rules translate to code. At the top of your Dreamweaver file, there should be two tabs; “text_selectors_1.html” and “text_selectors_1.css”. Click on “text_selectors_1.css” to see your CSS document. Your rules should look something like this: @charset “UTF-8”; h1 { font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #333333; text-align: center; letter-spacing: 1px; text-transform: uppercase; background-color: #99CC00; height: 30px; width: auto; padding-top: 8px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; border-top-width: 1px; border-top-style: dotted; border-top-color: #333333; border-right-width: 1px; border-left-width: 1px; border-right-style: dotted; border-left-style: dotted; border-right-color: #333333; border-left-color: #333333; } Take a closer look at all the “rules”. If you read them carefully, they make sense. Important things to note: - there is a “;” after each line - colors are always preceded by the “#” sign - “width: auto;” (line 11) means that the box behind the title will scale and shrink to the browser size (we will test this).
  • 8. III. DEFINING RULES FOR ALL YOUR TEXT 8 1. In the CSS panel, select “text_selectors_1.css” and in the properties window click “New CSS Rule” (page with “+” icon) 2. In “New CSS Rule” pop-up window select the following: - Selector Type: select “Tag” - Tag: h2 - Define in: “text_selectors_1.css” - click “ok” 3. Set up the following categories: Category: Type - Font: Arial, Helvetica, sans-serif - Size: 18 - Decoration: none - Color: #666666 Category: Block - Text align: center Click “ok” 4. Repeat step 1, and for “New CSS Rule” pop-up window select the following: - Selector Type: select “Tag” - Tag: h3 - Define in: “text_selectors_1.css” - click “ok” 5. Set up the following categories for h3: Category: Type - Font: Georgia, Times New Roman, Times, serif - Size: 12 - Decoration: none - Case: Uppercase - Color: #333333 Category: Block - Letter spacing: 2 pixels - Text align: left
  • 9. 6. Now set up the following categories for p: (repeating steps 1 + 2) 9 Category: Type - Font: Verdana, Arial, Helvetica, sans-serif - Size: 12 - Decoration: none - Color: #666666 Category: Block - Text align: left 7. Now set up the following categories for your link (the tag is “a”): (repeating steps 1 + 2) Category: Type - Font: Verdana, Arial, Helvetica, sans-serif - Size: 12 - Decoration: none - Color: #003366 Category: Block - Text align: left 8. Your page should look like this: Notice the following: - None of your html has changed at all! - click on the “text_selectors_1.html” tab. Now look at your CSS code. It should look like this:
  • 10. @charset “UTF-8”; 10 h1 { font-family: Arial, Helvetica, sans-serif; font-size: 20px; color: #333333; text-align: center; letter-spacing: 1px; text-transform: uppercase; background-color: #99CC00; height: 30px; width: auto; padding-top: 8px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; border-top-width: 1px; border-top-style: dotted; border-top-color: #333333; border-right-width: 1px; border-left-width: 1px; border-right-style: dotted; border-left-style: dotted; border-right-color: #333333; border-left-color: #333333; } h2 { font-family: Arial, Helvetica, sans-serif; font-size: 18px; color: #666666; text-align: center; } h3 { font-family: Georgia, “Times New Roman”, Times, serif; text-transform: uppercase; font-size: 12px; color: #333333; text-decoration: none; letter-spacing: 2px; text-align: left; } p { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #666666; text-decoration: none; } a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #003366; text-decoration: none; } Notice how each tag’s rules are defined between the open and closed “{ }”
  • 11. IV. TESTING YOUR WORK 11 1. Click on the tab “text_selectors_1.html” to go back to your html file. 2. Now let’s look at your work in a browser. Look for the globe icon at the top of your Dreamweaver window: Click and hold on the globe icon, select “Preview in Firefox”. Dreamweaver might ask if you want to save your file, save it if you haven’t already. Your site should preview in Firefox. Notice how your h1 box scales and contracts if you play with your browser window size. Also notice that your cursor changes over the link—however, the color of the link does not. Next, we will define different states for hyperlinks. V. DEFINING DIFFERENT STATES FOR HYPERLINKS USING THE PROPERTIES WINDOW There’s two ways to define the different “states” of your links in Dreamweaver. I will show you both. 1. Look at the properties window at the bottom of your screen. It looks like this: Click on the button that says “Page Properties.” It will open up a window that looks like this: Look at the left-hand side of the window, under the word “category.” Click on the word “Links.”
  • 12. 2. Clicking on the word “Links” will bring you to this screen: 12 Notice in the center of the screen you can select link color, visited, rollover, active.You can select different colors for the active and inactive “states” for your links. You can also define if your links have an underline or not. This is one of the few times you will ever need to use the property window, and in terms of CSS, this is technically considered “cheating” as you have not built in CSS rules for the different states of your hyperlinks. Let’s look at what this did to your html code: Yuck! What is this? Dreamweaver hardcoded your links into the html, messing up your nice clean markup. Let’s move on to create those rules in CSS in order to keep your html document as clean as possible. VI. DEFINING DIFFERENT STATES FOR HYPERLINKS IN YOUR CSS DOCUMENT 1. In Dreamweaver, look at the top of your window. Click over to the CSS tab. Your workspace should now look like this: Notice the highlighted section that reads as the following: a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #003366; text-decoration: none; } This defines how a link is displayed on your site. However, it DOES NOT define the different states of your link (hover, active, visited) like you can define in the properties window.
  • 13. Underneath your “a” style, key in the following in the CSS document: 13 a:link { color: #003366; text-decoration: none; } a:hover { color: #0955ef; text-decoration: none; } a:visited { color: #9bef09; text-decoration: none; } Notice that the above rules don’t include fonts, sizes, etc. This is because your “a” tag already defines this... this is the beauty of Cascading Style sheets. It follows a hierarchy of rules. Now, switch over to your Dreamweaver site “text_selectors_1.html”. Go into your code and manually delete the following: (all the “stuff” that Dreamweaver added when you defined your rollover in the properties window.) Be careful—only delete the code in between the gray arrows. Test your site. You should now have the colors you selected for the different states of your links. If it doesn’t work, clear your cache and try it again. If that doesn’t work, check to make sure your code (in CSS) in keyed in correctly. In the next tutorial, we will work with Class and ID selectors. Quick reference: Basic HTML Tags Tag Description <html> Defines an HTML document <body> Defines the document’s body <h1> to <h6> Defines headers 1 through 6 <p> Defines a paragraph <br> Inserts a single line break <hr> Defines a horizontal rule <a:link> <a:hover> <a:visited> Defines link states <!--> Defines a comment