Tutorial 4: Creating Special Effects with CSS

Size: px
Start display at page:

Download "Tutorial 4: Creating Special Effects with CSS"

Transcription

1 Tutorial 4: Creating Special Effects with CSS College of Computing & Information Technology King Abdulaziz University CPCS-403 Internet Applications Programming

2 Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover effect Create a drop cap using a pseudo-element Manage page layout with CSS Work with overflow and clipping styles Dealing with stacked objects Tutorial 4: Creating Special Effects with CSS page 2

3 Objectives Apply styles to various media Hide elements from printing Create and apply printer styles Create and prohibit page breaks for printing Tutorial 4: Creating Special Effects with CSS page 3

4 Tutorial 4 Web Site We ll modify site by adding: 1) Graphical bullets 2) Rollover effects 3) Drop caps Also, the site needs to work for any kind of output, including mobile devices and printed output Tutorial 4: Creating Special Effects with CSS page 4

5 Working with Selector Patterns Motivation for Contextual Selectors: Let s say you have several h2 elements And you want all of them to look the same Except for one of them You want that one to look different How do you do this? You could use an id attribute You would apply a specific id to the specific h2 tag that you want to look different from the rest And you would make a style for that specific id But the requires you keeping a (possibly) long list of id values for all the various elements on the page Tutorial 4: Creating Special Effects with CSS page 5

6 Working with Selector Patterns Motivation for Contextual Selectors: Let s say you have several h2 elements And you want all of them to look the same Except for one of them You want that one to look different Another Option: Make styles based on their location or use in the document css allows this through the use of contextual selectors Tutorial 4: Creating Special Effects with CSS page 6

7 Working with Selector Patterns Contextual Selectors: Thus far, we ve worked with styles in which the selector references either an element (or group of elements) or an element referenced by an id Example: b {color: blue} this makes all boldface text appear in a blue font But what if we didn t want every bold font to be blue? Instead, what if we only wanted bold text, which appeared inside a list, to be blue? How would we do that? Tutorial 4: Creating Special Effects with CSS page 7

8 Working with Selector Patterns Recall that on a Web page, elements are nested within other elements, forming a hierarchical tree structure Here s an example of a Web page that has a few headings, paragraph tags, and bold tags: Tutorial 4: Creating Special Effects with CSS page 8

9 Working with Selector Patterns Contextual Selectors: To take advantage of the hierarchical structure of Web page elements, CSS allows you to create contextual selectors What do contextual selectors do? They allow you to express the location of an element within the hierarchy of elements Syntax: parent descendant {styles} where parent is the parent element, descendant is a descendant of the parent, and styles are the styles applied to the descendant element Tutorial 4: Creating Special Effects with CSS page 9

10 Working with Selector Patterns Contextual Selectors: Example: Apply a blue color only to boldface text found in lists. You would use the style: li b {color: blue} In this case, li is the parent element, and b is the descendant element Any bold element not nested within a list element will not be affected by this style Also note that the descendant element does not have to be a direct descendant of the parent Tutorial 4: Creating Special Effects with CSS page 10

11 Working with Selector Patterns Contextual Selectors: contextual selectors can be grouped with other selectors Example: Apply a blue font to h2 headings and boldface list items You would use the style: li b, h2 {color: blue} Tutorial 4: Creating Special Effects with CSS page 11

12 Working with Selector Patterns Contextual Selectors: contextual selectors can be applied with elements marked with a specific id Example: Display bold text in a blue font if it is nested within an element with an id of notes You would use the style: #notes b {color: blue} Figures 4-3 and 4-4 (page ) show detailed examples of contextual selectors that can be used in CSS Tutorial 4: Creating Special Effects with CSS page 12

13 Working with Selector Patterns Attribute Selectors On occasion you might also need to select elements based on their attribute values Example: To display link text in a blue font, you would use: a {color: blue} However, this declaration makes no distinction between <a> tags used to mark links and <a> tags used to mark document anchors (see page 78 in book) HTML makes the distinction by the presence of the href attribute If the <a> tag has an href attribute, it is a link Otherwise it is an anchor (which is deprecated) Tutorial 4: Creating Special Effects with CSS page 13

14 Working with Selector Patterns Attribute Selectors On occasion you might also need to select elements based on their attribute values Now examine the following declaration: a[href] {color: blue} This applies the blue font color style only to link elements that contain an href attribute So any <a> tag used to mark anchors would not contain the href attribute, and therefore would not be affected by this style See Figure 4-5 for a detailed listing of other attribute selectors supported by CSS Tutorial 4: Creating Special Effects with CSS page 14

15 Using Selector Patterns To apply a style to all elements in the document, use the * selector To apply a style to a single element, use the e selector, where e is the name of the element To apply a selector to a descendant element, f, use the e f selector, where e is the name of the parent element and f is an element nested within the parent To apply a selector to a child element, f, use the e > f selector, where e is the name of a parent element and f is an element that is a direct child of the parent To apply a selector to a sibling element, use the e + f selector, where e and f are siblings and f immediately follows e in the document tree Tutorial 4: Creating Special Effects with CSS page 15

16 Tutorial 4 Web Site Notice the h2 heading called Basic Materials We want to create a specific style for this heading But we don t want to affect the other h2 headings Tutorial 4: Creating Special Effects with CSS page 16

17 Tutorial 4 Website Modify Basic Materials h2 heading: This heading currently appears within a div element that is identified by an id value named pullout So we simply modify the style sheet, adding a contextual selector to the pullout style: The selector #pullout h2 will reference only those h2 elements within an element with the pullout id Tutorial 4: Creating Special Effects with CSS page 17

18 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 18

19 Tutorial 4 Website Result Links on left side of page: Notice that the links are in an unordered list, which is displayed in a box floated on the left page margin Like all unordered lists, the browser displays the list items with bullet markers How would you remove the bullet marker? Or perhaps choose a different type of bullet? Tutorial 4: Creating Special Effects with CSS page 19

20 Applying Styles to Lists To specify the list marker displayed by the browser, you can apply the style list-style-type: type where type is one of the following markers: Tutorial 4: Creating Special Effects with CSS page 20

21 Applying Styles to Lists List Style Types: Example: To create a list with alphabetical markers such as A. Home B. Getting Started C. Scrapbooking Tips D. Supply List you would apply the following list style to the ol list element: ol {list-style-type: upper-alpha} Tutorial 4: Creating Special Effects with CSS page 21

22 Applying Styles to Lists Nested Lists and Contextual Selectors List style types can be used with contextual selectors to create an outline style for several levels of nested lists The following page shows an example in which several levels of list style markers are used in formatting an outline Note that each marker style is determined by the location of each ordered list within the levels of the outline Tutorial 4: Creating Special Effects with CSS page 22

23 Applying Styles to Lists Tutorial 4: Creating Special Effects with CSS page 23

24 Applying Styles to Lists Using Custom List Markers If you don t like any of the markers (bullets) in the list-style-type style, you can supply your own in a graphic image file Use the style: list-style-image: url(url) where (url) is the URL of the graphic image file Example: Display items in an unordered list marked with a graphic image file named redball.gif: ul {list-style-image: url(redball.gif) } Tutorial 4: Creating Special Effects with CSS page 24

25 Tutorial 4 Website Left side links: We will modify these links so they appear without any bullet marker Links inside Basic Materials box These links should use a bullet marker based off of a graphic image file (bullet.jpg) How to differentiate between the two lists: Use contextual selectors! List of links is nested inside a div container with an id named links Basic Materials box is nested within the pullout div box Tutorial 4: Creating Special Effects with CSS page 25

26 Tutorial 4 Website We simply modify the css file as follows: Tutorial 4: Creating Special Effects with CSS page 26

27 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 27

28 Applying Styles to Lists Lists are treated as block-level elements Most browsers place the list marker to the left of the block, lining up the markers with each list item You can change this default behavior using the style: list-style-position: position where position is either outside (the default) or inside When using inside, the marker is placed inside the block, causing the list text to flow around the marker More on page (padding & margins) Tutorial 4: Creating Special Effects with CSS page 28

29 Applying Styles to Lists List Marker Positions: Tutorial 4: Creating Special Effects with CSS page 29

30 Tutorial 4 Website Left side links There are three main subtopics within the links: Pages that teach scrapbooking Pages that sell products Pages that give information about the company The links are ordered by these subtopics But there is no visual separation between the subtopics of links We want the links to appear as three groups One way to do this is to mark the first link, in each group, and then increase the top margin for those links We mark those links using the class attribute Tutorial 4: Creating Special Effects with CSS page 30

31 Working with Classes The class attribute is used when you want to identify elements that share a common characteristic Syntax: <elem class="class">... </elem> where elem is an element in the body of the Web page and class is a name that identifies the class of objects to which the element belongs Tutorial 4: Creating Special Effects with CSS page 31

32 Working with Classes Class Attribute Example: Examine the following HTML code: <h2 class="subtitle">getting Started</h2> <h2 class="subtitle">preserving Your Memories</h2> This code marks both of the h2 headings as belonging to the subtitle class Note, that unlike the id attribute, several elements can share the same class value Meaning, multiple elements can belong to the same class Also note that the class value need not be assigned to the same type of element Example: h3 and <p> tags can belong to the same class Tutorial 4: Creating Special Effects with CSS page 32

33 Working with Classes Advantage of class attribute You can use it to assign the same style to multiple elements sharing the same class value The selector for the class attribute is.class {styles} where class is the name of the class and styles are the styles applied to that class of element Example: Display all elements belonging to the subtitle class in a blue font:.subtitle {color: blue} Tutorial 4: Creating Special Effects with CSS page 33

34 Working with Classes More details on class attributes: Remember that the same class name can be used with elements of different types As such, you may need to specify exactly which elements of a particular class receive a defined style Syntax: elem.class {styles} where elem is the element and class is the class Example: h2.subtitle {color: blue} applies a blue font to elements of the subtitle class, but only if they are h2 headings Tutorial 4: Creating Special Effects with CSS page 34

35 Tutorial 4 Website We want to create a visual separation between the three groups of links The three links are Home, Online Store, and About Us We will mark these three links as belonging to a class called newgroup Then we will apply a style that increases the top margin of those elements Tutorial 4: Creating Special Effects with CSS page 35

36 Tutorial 4 Website Mark the links as new Group : Create a newgroup style: Tutorial 4: Creating Special Effects with CSS page 36

37 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 37

38 Brief Interlude: Human Stupidity Tutorial 4: Creating Special Effects with CSS page 38

39 Tutorial 4 Website Links now look much better But Kathy thinks the large block of underlined links is difficult to read She doesn t want the links underlined except when the mouse pointer hovers over the link Only then should an underline appear This is called a rollover effect, because it applies only when a user rolls the mouse over an element We can create rollover effects using pseudoclasses Tutorial 4: Creating Special Effects with CSS page 39

40 Using Pseudo-Classes and Pseudo-Elements What is a pseudo-class? it is a classification of an element based on its current status, position, or use in the document Example: One pseudo-class indicates whether a link has been previously visited by the user Another pseudo-class indicates whether a link is currently being activated or clicked To create a style for a pseudo-class, use the style: selector:pseudo-class {styles} where selector is an element or group of elements within a document, pseudo-class is the name of the pseudo-class and styles are the styles you want to apply Tutorial 4: Creating Special Effects with CSS page 40

41 Using Pseudo-Classes and Pseudo-Elements Pseudo-classes supported by CSS: Tutorial 4: Creating Special Effects with CSS page 41

42 Using Pseudo-Classes and Pseudo-Elements Example of rollover effect: If you want the font color of your links to change to red after they ve been visited, you could use the following style declaration: a.visited {color: red} Or to change the font color of your links to green only while the mouse hovers over the link, use: a.hover {color: green} Tutorial 4: Creating Special Effects with CSS page 42

43 Tutorial 4 Website Using rollover effects: Kathy wants to remove the default underlining of links If the mouse hovers over a link, she wants the text to appear in a black font and underlined She ll use the following style declarations: Tutorial 4: Creating Special Effects with CSS page 43

44 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 44

45 Tutorial 4 Website Creating a Drop Cap Kathy wants to apply the following effects to the first paragraph on the page: The first line should be displayed in small caps style The first letter should be increased in size and displayed as a drop cap Tutorial 4: Creating Special Effects with CSS page 45

46 Using Pseudo-Classes and Pseudo-Elements Creating a Drop Cap We can define selectors based on pseudoelements that are not part of the document tree Instead, they are abstracted from what we know of an element s content, use, or position in the document Example: A paragraph element is part of the document tree and is marked with the <p> tag But the first line of the paragraph is not marked There is no first line element, even though we intuitively know where the first line is located Tutorial 4: Creating Special Effects with CSS page 46

47 Using Pseudo-Classes and Pseudo-Elements Syntax of a pseudo-element selector: selector:pseudo-element {styles} where selector is an element or group of elements within the document, pseudo-element is an abstract element based on the selector, and styles are the styles you want to apply to the pseudo-element. Here are some pseudo-elements supported by CSS Tutorial 4: Creating Special Effects with CSS page 47

48 Tutorial 4 Website Remember, Kathy wants two new effects: The first line should be displayed in small caps style The first letter should be increased in size and displayed as a drop cap We use the style declarations: Note: the first paragraph already has an id applied to it with the name firstp Tutorial 4: Creating Special Effects with CSS page 48

49 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 49

50 Tutorial 4 Website Kathy wants to show scrapbook samples each month And she wants to have callouts that highlight certain portions of the scrapbook sample for the reader Each callout box should be placed close to the feature it highlights The following is a sketch of what she wants Tutorial 4: Creating Special Effects with CSS page 50

51 Tutorial 4 Website Here s a sketch of what she wants Notice the three boxes labeled note #1, note #2, and note #3 Each note will be inserted in a div container with specific id values Each container will also belong to the same class, allowing a common set of styles to be placed on them Tutorial 4: Creating Special Effects with CSS page 51

52 Tutorial 4 Website Create div containers for each note Tutorial 4: Creating Special Effects with CSS page 52

53 Tutorial 4 Website The styles in this task will apply only to this page and no others in Kathy s Web site So we use an embedded style sheet Text should appear in a brown 8-point sans-serif font on an ivory background. Boxes should have a 3-pixel light gray inset border. Notes should be 130 pixels wide, with a margin space of 5 pixels around the paragraphs Tutorial 4: Creating Special Effects with CSS page 53

54 Tutorial 4 Website Here s how the boxes will now look: Note: the boxes are placed side-byside in this figure for viewing purposes only. At this point, in the browser, they would appear stacked, one on top of the other Now we simply need to position the boxes at the appropriate locations on the Samples page Tutorial 4: Creating Special Effects with CSS page 54

55 Positioning Objects with CSS The Position Style: CSS-P (CSS-Positioning) became part of the specification for CSS2, and positioning styles were some of the first CSS2 styles to be adopted by browsers To position an element, use the style: position: type; top: value; right: value; bottom: value; left: value; where type indicates the type of positioning applied to the element, and the top, right, bottom, and left styles indicate the coordinates of those edges of the element Tutorial 4: Creating Special Effects with CSS page 55

56 Positioning Objects with CSS The position style has five possible values: static, absolute, relative, fixed, and inherit The default position is static Enables browsers to place an element based on where it flows in the document Essentially the same as not using any CSS positioning at all Any values that you specify for the left or top styles are simply ignored by the browser when static is used Tutorial 4: Creating Special Effects with CSS page 56

57 Positioning Objects with CSS The position style has five possible values: Absolute positioning enables you to place an element at specific coordinates either on a page or within a containing element position: absolute; left: 100px; top: 50px places an element at the coordinates (100, 50) or 100 pixels to the right and 50 pixels down from the upper-left corner of the page OR from the container element Once an element has been placed using absolute positioning, it affects the placement of other objects on the page Tutorial 4: Creating Special Effects with CSS page 57

58 Positioning Objects with CSS The position style has five possible values: Relative positioning is used to move an element relative to its default position on the page position: relative; left: 100px; top: 50px places an element 100 pixels to the right and 50 pixels down from its normal placement in a browser window Relative positioning does NOT affect the position of other elements on a page Other elements retain their original position, as if the element had never been moved See book (p 230) & demo for detailed examples Tutorial 4: Creating Special Effects with CSS page 58

59 Positioning Objects with CSS The position style has five possible values: You can fix an element at a specific spot in the document window while the rest of the page scrolls by setting the value of the position style to fixed Not all browsers support this proceed with caution You can assign the inherit position style to an element so that it inherits the position value of its parent element Download DEMO for Tutorial 4 and play with it: Tutorial 4: Creating Special Effects with CSS page 59

60 Tutorial 4 Website Position the Callout Boxes We ve already styled the callout boxes Now we can position them on the Scrapbooks sample page by adding the following styles to the embedded style sheet: Notice that we used absolute positioning for each callout box Tutorial 4: Creating Special Effects with CSS page 60

61 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 61

62 Tutorial 4 Website Kathy likes the changes But she s picky! And she feels the boxes are too large They cover up too much of the actual scrapbook sample image So we need to make the callout boxes less intrusive Tutorial 4: Creating Special Effects with CSS page 62

63 Working with Overflow and Clipping Just reduce the height of the box? Unfortunately, this wouldn t work. Why? If you simply decrease the height of the box, the height would still expand to accommodate the content If you want to force an element into a specified height and width, you have to define how the browser should handle a situation where content overflows the space allotted to the object Tutorial 4: Creating Special Effects with CSS page 63

64 Working with Overflow and Clipping Dealing with overflow Syntax of the overflow style: overflow: type where type is visible (the default), hidden, scroll, or auto Tutorial 4: Creating Special Effects with CSS page 64

65 Tutorial 4 Website Fixing the callout boxes The boxes were too large (per Kathy) So we limit the height of each callout box to 90 pixels, and we display scroll bars as needed We set the overflow style to auto Tutorial 4: Creating Special Effects with CSS page 65

66 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 66

67 Working with Overflow and Clipping Clipping an Element The clip style allows you to define a rectangular region through which the element s content can be viewed Anything that lies outside the boundary of the rectangle is hidden Syntax: clip: rect(top, right, bottom, left) where top, right, bottom, and left define the coordinates of the clipping rectangle Tutorial 4: Creating Special Effects with CSS page 67

68 Working with Overflow and Clipping Clipping an Element Example: clip rect(10, 175, 125, 75) Defines a clip region whose top and bottom edges are 10 and 125 pixels from the top of the element, and whose right and left edges are 175 and 75 pixels from the left side Tutorial 4: Creating Special Effects with CSS page 68

69 Stacking Elements Problems with positioning elements: Objects can sometimes overlap each other By default, elements that are formatted later in the page are stacked on top of earlier elements Also, elements placed using CSS positioning are stacked on top of elements that are not To specify a different stacking order, use the style: z-index: value where value is a positive or negative integer or the keyword auto Tutorial 4: Creating Special Effects with CSS page 69

70 Stacking Elements Z-index Style: Objects are stacked based on their z-index value, with the highest z-index value placed on top Tutorial 4: Creating Special Effects with CSS page 70

71 Stacking Elements Z-index Style: Only works for elements placed with absolute positioning Also, an element s z-index value determines its position relative only to the other elements that share a common parent Example: Study the graphic on the next page The object with the highest z-index (4) is still covered Why? Because it is nested within another object that has a low z- index (1) Tutorial 4: Creating Special Effects with CSS page 71

72 Stacking Elements Z-index Example: Tutorial 4: Creating Special Effects with CSS page 72

73 Tutorial 4: Creating Special Effects with CSS WASN T THAT BREAKTAKING! Tutorial 4: Creating Special Effects with CSS page 73

74 Daily Demotivator Tutorial 4: Creating Special Effects with CSS page 74

75 Tutorial 4: Creating Special Effects with CSS College of Computing & Information Technology King Abdulaziz University CPCS-403 Internet Applications Programming

76 Objectives Apply styles to various media Hide elements from printing Create and apply printer styles Create and prohibit page breaks for printing Tutorial 4: Creating Special Effects with CSS page 76

77 Tutorial 4 Website Problem printing The site looks good right now But Kathy says the pages don t print well When a customer prints the sample scrapbook page, they don t need a printout of the header logo or the left side links They just want the scrapbook page And, ideally, they want the notes (callout boxes) to be printed on a separate page So they don t cover up the scrapbook sample page Tutorial 4: Creating Special Effects with CSS page 77

78 Tutorial 4 Website Kathy s proposed printed output: Tutorial 4: Creating Special Effects with CSS page 78

79 Tutorial 4 Website Problem printing So what is the solution? We could create two different versions of the Samples page: one for screens and one for print But then you have to maintain two pages with effectively the same content. That makes no sense! Guess what: Since we ve moved the styling away from the content, we can simply make a separate style sheet specifically for printing purposes We ll have one page, but rendered different based on the style sheet applied to it Tutorial 4: Creating Special Effects with CSS page 79

80 Working with Different Media Media Types By default, a style sheet is applied to all devices, and each device must determine how best to match the styles to its own requirements To specify the media, you use the media attribute: <style type="text/css" media="type">... </style> or <link href="url" type="text/css" media="type"... /> where type is the type of media used by the style sheet Tutorial 4: Creating Special Effects with CSS page 80

81 Working with Different Media Table of values for the media attribute: See page 241 for more details Tutorial 4: Creating Special Effects with CSS page 81

82 Working with Different Media You can use a single style sheet broken down into different sections for each media type You do this using the type { style declarations } where type is one of the supported media types and style declarations are style declarations associated with that media type Tutorial 4: Creating Special Effects with CSS page 82

83 Working with Different Media You can use a single style sheet broken down into different sections for each media type Example: The following style sheet is broken into four sections with different styles for each screen { body {font-size: 1em} h1 {font-size: 2em} print { body {font-size: 12pt} h1 {font-size: 16pt} handheld { body {font-size: 8pt} h1 {font-size: 12pt} tv { body {font-size: 16pt} h1 {font-size: 24pt} } Tutorial 4: Creating Special Effects with CSS page 83

84 Working with Different Media Differences between different media types is not always clear Ex: how is projection media different from screen media? The difference lies in what kind of output can be sent to the media All output can be described based on some common properties CSS uses media groups to describe how different media devices render content Tutorial 4: Creating Special Effects with CSS page 84

85 Working with Different Media CSS uses four media groups based on the following characteristics: Continuous or paged Visual, aural, or tactile Grid (for character grid devices) or bitmap Interactive (for devices that allow user interaction) or static (for devices that allow no interaction) Tutorial 4: Creating Special Effects with CSS page 85

86 Working with Different Media The following table shows how all output media are categorized based on the four media groups: Tutorial 4: Creating Special Effects with CSS page 86

87 Tutorial 4 Website Making a css style sheet for printing From our samples.htm web page, we will link to another css file, print.css So now two css files will be linked to this one web page Which will be used? That depends on the media! If the page is being viewed, it will use scraps.css If the page is being printed, it will use print.css Tutorial 4: Creating Special Effects with CSS page 87

88 Tutorial 4 Website Making a css style sheet for printing The samples.htm file also includes an embedded style sheet Like the external style sheet, we need to create two embedded sheets as well Note: we haven t actually declared the styles yet Tutorial 4: Creating Special Effects with CSS page 88

89 Tutorial 4 Website Examine Kathy s sketch of her proposed print version of the Samples page What do you immediately notice? Many elements are missing! Such as the list of links and the address at the bottom How do we magically remove these elements? Thankfully, it is easy! CSS has two styles that you can use to keep an element from being displayed in the output The display style and the visibility style Tutorial 4: Creating Special Effects with CSS page 89

90 Hiding Elements CSS has two styles that you can use to keep an element from being displayed in the output 1) The display style This style supports the value none causes the element to not be rendered to the output device This is precisely what we want! Tutorial 4: Creating Special Effects with CSS page 90

91 Hiding Elements CSS has two styles that you can use to keep an element from being displayed in the output 2) The visibility style Syntax: visibility: type where type is visible, hidden, collapse, or inherit (which is the default) Unlike the display style, the visibility style hides an element, but it does NOT remove it from the flow of elements on the page Compare the two styles on the next page Tutorial 4: Creating Special Effects with CSS page 91

92 Hiding Elements Comparing Visibility and Display Styles Tutorial 4: Creating Special Effects with CSS page 92

93 Hiding Elements CSS has two styles that you can use to keep an element from being displayed in the output Based on the previous graphic, it is clear that the display: none style is more appropriate for our purposes and is usually more appropriate whenever you want to hide elements Tutorial 4: Creating Special Effects with CSS page 93

94 Tutorial 4 Website For the print version, Kathy wants to hide the following div elements: head, links, and address And she wants all headings to appear in a sansserif font We add the following style declarations in the print.css file: Tutorial 4: Creating Special Effects with CSS page 94

95 Tutorial 4 Website Also, For the print version, Kathy wants the callout boxes to print as a bulleted list We change the style of the boxes by using the following display style: display: list-item we also use the same bullet.jpg graphic and set the text to a 12-point sans-serif font with a margin of 20 pixels Add the following to the embedded style sheet: Tutorial 4: Creating Special Effects with CSS page 95

96 Tutorial 4 Website Result Now, reload the samples.htm file Does it look different? Why not? Because we are viewing it on a screen! And the modifications we just made were for print media To confirm that the print styles are working, either print the web page or use your browser s Print Preview command to preview the printed version Tutorial 4: Creating Special Effects with CSS page 96

97 Brief Interlude: Human Stupidity Tutorial 4: Creating Special Effects with CSS page 97

98 Tutorial 4 Website Here s the printed output of the same HTML page Cool how this is the same page but looks completely different Such is the power of CSS! Tutorial 4: Creating Special Effects with CSS page 98

99 Tutorial 4 Website Kathy likes the printout! but... she s kinda picky huh She wants the notes to appear on a separate page So we need to use a page break in the middle of the document Page breaks are not supported by media types such as computer screens But they are supported in printed output and for projection devices Tutorial 4: Creating Special Effects with CSS page 99

100 Using Print Styles CSS defines printed pages by extending the box model (described in Tutorial 3) The entire page is incorporated in a page box The page box has 2 areas: The page area: contains the content of the document The margin area: contains the space between the printed content and the edges of the page Tutorial 4: Creating Special Effects with CSS page 100

101 Using Print Styles The Page Box The general rule to create and define a page box {styles} where styles are the styles you want applied to the page {margin: 5in} this page rule sets the page margin for printed output to 5 inches Note: you should only use inches or centimeters See page 249 for more details Tutorial 4: Creating Special Effects with CSS page 101

102 Using Print Styles Setting the Page Size: Printed media can vary in size and orientation The size style allows the Web author to define the default dimensions and orientation of the printed page Syntax: size: width height orientation where width and height are the width and height of the page, and orientation is the orientation of the page (portrait or landscape) Tutorial 4: Creating Special Effects with CSS page 102

103 Using Print Styles Setting the Page Size: {size: 8.5in 11in landscape; margin: 1in} This formats a print page as a standard-size page in landscape orientation with a 1-inch margin Example {size: 8.5in 11in; margin: 1in} The orientation is not show here Browsers will assume portrait by default Tutorial 4: Creating Special Effects with CSS page 103

104 Working with Page Breaks When a document is sent to the printer, the printer decides the location of the page breaks unless that information is included as part of the print style To specify page breaks before or after a page element, you use the styles: page-break-before: type page-break-after: type where type can be one of the options on the following page Tutorial 4: Creating Special Effects with CSS page 104

105 Working with Page Breaks The type style attribute has the following values: Always, to always place a page break before or after the element Avoid, to never place a page break Left, to place a page break where the next page will be a left page Right, same as above, but for a right page Auto, allows the printer to determine page breaks Inherit, to insert the page break style from the parent element Tutorial 4: Creating Special Effects with CSS page 105

106 Working with Page Breaks Page Break Examples: Example 1: If you want h1 headings to always be placed at the start of a new page, you would use: h1 {page-break-before: always} Example 2: If you want block quotes to always appear on their own page, you would use a page break before and after the block quote style blockquote {page-break-before: always; page-break-after: always} Tutorial 4: Creating Special Effects with CSS page 106

107 Working with Page Breaks A widow occurs when only a few ending lines of an element appear at the top of a page An orphan is just the opposite: it occurs when only a few beginning lines of an element appear at the bottom of a page The styles to control the appearance of widows and orphans in the printout are: widow: value orphan: value where value is the number of lines that must appear within the element before a page break can be inserted Tutorial 4: Creating Special Effects with CSS page 107

108 Tutorial 4 Website Remember what Kathy wants She wants the notes to appear on a separate page We can put a page break after the third callout note Or we can put a page break before the inline image of the scrapbooking sample Also, Kathy wants the sample image itself to be enlarged to better fit the print page Enlarged to 7 wide by 9.1 tall The img element is part of a div container, so we can simply adjust the size as part of the container Tutorial 4: Creating Special Effects with CSS page 108

109 Tutorial 4 Website We add the following declarations to the print.css style sheet: Tutorial 4: Creating Special Effects with CSS page 109

110 Tutorial 4 Website Result Tutorial 4: Creating Special Effects with CSS page 110

111 Summary Worked with CSS selectors Created styles for lists Created and applied class styles Created a rollover effect Created a drop cap using a pseudo-element Managed page layout with CSS Worked with overflow and clipping styles Tutorial 4: Creating Special Effects with CSS page 111

112 Summary Created stacked objects Applied styles to various media Hid elements from printing Created and applied printer styles Created and prohibited page breaks for printing Tutorial 4: Creating Special Effects with CSS page 112

113 Tutorial 4: Creating Special Effects with CSS WASN T THAT DYNAMITE! Tutorial 4: Creating Special Effects with CSS page 113

114 Daily Demotivator Tutorial 4: Creating Special Effects with CSS page 114

115 Tutorial 4: Creating Special Effects with CSS College of Computing & Information Technology King Abdulaziz University CPCS-403 Internet Applications Programming

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development Objectives INFS 2150 Introduction to Web Development 3. Page Layout Design Create a reset style sheet Explore page layout designs Center a block element Create a floating element Clear a floating layout

More information

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development INFS 2150 Introduction to Web Development 3. Page Layout Design Objectives Create a reset style sheet Explore page layout designs Center a block element Create a floating element Clear a floating layout

More information

BIM222 Internet Programming

BIM222 Internet Programming BIM222 Internet Programming Week 7 Cascading Style Sheets (CSS) Adding Style to your Pages Part II March 20, 2018 Review: What is CSS? CSS stands for Cascading Style Sheets CSS describes how HTML elements

More information

Tutorial 3: Working with Cascading Style Sheets

Tutorial 3: Working with Cascading Style Sheets Tutorial 3: Working with Cascading Style Sheets College of Computing & Information Technology King Abdulaziz University CPCS-665 Internet Technology Objectives Review the history and concepts of CSS Explore

More information

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC

CSS. Selectors & Measurments. Copyright DevelopIntelligence LLC CSS Selectors & Measurments 1 Back to descendants remember walking down the document tree structure and see how parents and children interact not only is it important to know about inheritance walking

More information

Chapter 3 Style Sheets: CSS

Chapter 3 Style Sheets: CSS WEB TECHNOLOGIES A COMPUTER SCIENCE PERSPECTIVE JEFFREY C. JACKSON Chapter 3 Style Sheets: CSS 1 Motivation HTML markup can be used to represent Semantics: h1 means that an element is a top-level heading

More information

8a. Cascading Style Sheet

8a. Cascading Style Sheet INFS 2150 Introduction to Web Development 8a. Cascading Style Sheet 1 Objectives Concepts of cascading style sheets (CSS). 3 ways of using CSS: inline styles, embedded styles, and external style sheet.

More information

CSS Selectors. element selectors. .class selectors. #id selectors

CSS Selectors. element selectors. .class selectors. #id selectors CSS Selectors Patterns used to select elements to style. CSS selectors refer either to a class, an id, an HTML element, or some combination thereof, followed by a list of styling declarations. Selectors

More information

Media Types & Media Features

Media Types & Media Features Media Types & Media Features Same HTML, Different CSS R. Scott Granneman r Jans Carton 1.6 2008 R. Scott Granneman Last updated 2018-08-21 You are free to use this work, with certain restrictions. For

More information

Class 3 Page 1. Using DW tools to learn CSS. Intro to Web Design using Dreamweaver (VBUS 010) Instructor: Robert Lee

Class 3 Page 1. Using DW tools to learn CSS. Intro to Web Design using Dreamweaver (VBUS 010) Instructor: Robert Lee Class 3 Page 1 Using DW tools to learn CSS Dreaweaver provides a way for beginners to learn CSS. Here s how: After a page is set up, you might want to style the . Like setting up font-family, or

More information

CSS. https://developer.mozilla.org/en-us/docs/web/css

CSS. https://developer.mozilla.org/en-us/docs/web/css CSS https://developer.mozilla.org/en-us/docs/web/css http://www.w3schools.com/css/default.asp Cascading Style Sheets Specifying visual style and layout for an HTML document HTML elements inherit CSS properties

More information

2. Write style rules for how you d like certain elements to look.

2. Write style rules for how you d like certain elements to look. CSS for presentation Cascading Style Sheet Orientation CSS Cascading Style Sheet is a language that allows the user to change the appearance or presentation of elements on the page: the size, style, and

More information

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

<style type=text/css> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page*** Chapter 7 Using Advanced Cascading Style Sheets HTML is limited in its ability to define the appearance, or style, across one or mare Web pages. We use Cascading style sheets to accomplish this. Remember

More information

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development Objectives INFS 2150 Introduction to Web Development Create a media query Work with the browser viewport Apply a responsive design Create a pulldown menu with CSS Create a flexbox 5. Mobile Web INFS 2150

More information

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development INFS 2150 Introduction to Web Development 5. Mobile Web Objectives Create a media query Work with the browser viewport Apply a responsive design Create a pulldown menu with CSS Create a flexbox INFS 2150

More information

CSS THE M\SS1NG MANUAL. David Sawyer McFarland. POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo

CSS THE M\SS1NG MANUAL. David Sawyer McFarland. POGUE PRESS O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo CSS THE M\SS1NG MANUAL David Sawyer McFarland POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo Table of Contents The Missing Credits Introduction xiii I Part One: CSS

More information

COSC 2206 Internet Tools. CSS Cascading Style Sheets

COSC 2206 Internet Tools. CSS Cascading Style Sheets COSC 2206 Internet Tools CSS Cascading Style Sheets 1 W3C CSS Reference The official reference is here www.w3.org/style/css/ 2 W3C CSS Validator You can upload a CSS file and the validator will check it

More information

Parashar Technologies HTML Lecture Notes-4

Parashar Technologies HTML Lecture Notes-4 CSS Links Links can be styled in different ways. HTML Lecture Notes-4 Styling Links Links can be styled with any CSS property (e.g. color, font-family, background, etc.). a { color: #FF0000; In addition,

More information

Cascading Style Sheets

Cascading Style Sheets 4 TVEZEWXYHMNR LSTVSKVEQY-RJSVQEXMOENITSHTSVSZ RETVSNIOXIQ RERGSZER Q^)ZVSTWO LSWSGM PR LSJSRHYEVS^TS XYLPEZR LSQ WXE4VEL] 4VELE)9-RZIWXYNIQIHSZE% FYHSYGRSWXM CSS Cascading Style Sheets Lukáš Bařinka barinkl@fel.cvut.cz

More information

Web Engineering CSS. By Assistant Prof Malik M Ali

Web Engineering CSS. By Assistant Prof Malik M Ali Web Engineering CSS By Assistant Prof Malik M Ali Overview of CSS CSS : Cascading Style Sheet a style is a formatting rule. That rule can be applied to an individual tag element, to all instances of a

More information

FrontPage 2000 Tutorial -- Advanced

FrontPage 2000 Tutorial -- Advanced FrontPage 2000 Tutorial -- Advanced Shared Borders Shared Borders are parts of the web page that share content with the other pages in the web. They are located at the top, bottom, left side, or right

More information

NAVIGATION INSTRUCTIONS

NAVIGATION INSTRUCTIONS CLASS :: 13 12.01 2014 NAVIGATION INSTRUCTIONS SIMPLE CSS MENU W/ HOVER EFFECTS :: The Nav Element :: Styling the Nav :: UL, LI, and Anchor Elements :: Styling the UL and LI Elements CSS DROP-DOWN MENU

More information

CSS: The Basics CISC 282 September 20, 2014

CSS: The Basics CISC 282 September 20, 2014 CSS: The Basics CISC 282 September 20, 2014 Style Sheets System for defining a document's style Used in many contexts Desktop publishing Markup languages Cascading Style Sheets (CSS) Style sheets for HTML

More information

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS2.1 reflects browser implementations - CSS3 is partially finished and parts are implemented in current browsers

More information

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS2.1 reflects browser implementations - CSS3 is partially finished and parts are implemented in current browsers

More information

CSS: Cascading Style Sheets

CSS: Cascading Style Sheets What are Style Sheets CSS: Cascading Style Sheets Representation and Management of Data on the Internet, CS Department, Hebrew University, 2007 A style sheet is a mechanism that allows to specify how HTML

More information

Appendix D CSS Properties and Values

Appendix D CSS Properties and Values HTML Appendix D CSS Properties and Values This appendix provides a brief review of Cascading Style Sheets (CSS) concepts and terminology, and lists CSS level 1 and 2 properties and values supported by

More information

Chapter 11 CSS2. Presented by Thomas Powell. Slides adopted from HTML & XHTML: The Complete Reference, 4th Edition 2003 Thomas A.

Chapter 11 CSS2. Presented by Thomas Powell. Slides adopted from HTML & XHTML: The Complete Reference, 4th Edition 2003 Thomas A. Chapter 11 CSS2 Presented by Thomas Powell Slides adopted from HTML & XHTML: The Complete Reference, 4th Edition 2003 Thomas A. Powell CSS2 CSS2 (http://www.w3.org/tr/rec-css2/ ) was finalized in May 1998

More information

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student Welcome Please sit on alternating rows powered by lucid & no.dots.nl/student HTML && CSS Workshop Day Day two, November January 276 powered by lucid & no.dots.nl/student About the Workshop Day two: CSS

More information

DAY 4. Coding External Style Sheets

DAY 4. Coding External Style Sheets DAY 4 Coding External Style Sheets LESSON LEARNING TARGETS I can code and apply an embedded style sheet to a Web page. I can code and apply an external style sheet to multiple Web pages. I can code and

More information

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS) Cascading Style Sheets (CSS) Mendel Rosenblum 1 Driving problem behind CSS What font type and size does introduction generate? Answer: Some default from the browser (HTML tells what browser how)

More information

Using Dreamweaver to Create Page Layouts

Using Dreamweaver to Create Page Layouts Using Dreamweaver to Create Page Layouts with Cascading Style Sheets (CSS) What are Cascading Style Sheets? Each cascading style sheet is a set of rules that provides consistent formatting or a single

More information

CSS. Shan-Hung Wu CS, NTHU

CSS. Shan-Hung Wu CS, NTHU CSS Shan-Hung Wu CS, NTHU CSS Zen Garden 2 Outline The Basics Selectors Layout Stacking Order 3 Outline The Basics Selectors Layout Stacking Order 4 Grammar selector { property: value; 5 Example /* for

More information

How to lay out a web page with CSS

How to lay out a web page with CSS Activity 2.6 guide How to lay out a web page with CSS You can use table design features in Adobe Dreamweaver CS4 to create a simple page layout. However, a more powerful technique is to use Cascading Style

More information

The Benefits of CSS. Less work: Change look of the whole site with one edit

The Benefits of CSS. Less work: Change look of the whole site with one edit 11 INTRODUCING CSS OVERVIEW The benefits of CSS Inheritance Understanding document structure Writing style rules Attaching styles to the HTML document The cascade The box model CSS units of measurement

More information

Media-Specific Styles

Media-Specific Styles Media-Specific Styles Same HTML, Different CSS R. Scott Granneman r Jans Carton 1.5 2008 R. Scott Granneman Last updated 2017-06-13 You are free to use this work, with certain restrictions. For full licensing

More information

CSS Styles Quick Reference Guide

CSS Styles Quick Reference Guide Table 1: CSS Font and Text Properties Font & Text Properties Example(s) font-family Font or typeface font-family: Tahoma font-size Size of the font font-size: 12pt font-weight Normal or bold font-weight:

More information

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

CSS مفاهیم ساختار و اصول استفاده و به کارگیری CSS مفاهیم ساختار و اصول استفاده و به کارگیری Cascading Style Sheets A Cascading Style Sheet (CSS) describes the appearance of an HTML page in a separate document : مسایای استفاده از CSS It lets you separate

More information

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

CSS: Layout Part 2. clear. CSS for layout and formatting: clear CSS: Layout Part 2 Robert A. Fulkerson College of Information Science and Technology http://www.ist.unomaha.edu/ University of Nebraska at Omaha http://www.unomaha.edu/ CSS for layout and formatting: clear

More information

CSS: Cascading Style Sheets

CSS: Cascading Style Sheets CSS: Cascading Style Sheets Computer Science and Engineering College of Engineering The Ohio State University Lecture 13 Evolution of CSS MIME type: text/css CSS 1 ('96): early recognition of value CSS

More information

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning Page Layout contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning 2 1 4.1

More information

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space. HTML Summary Structure All of the following are containers. Structure Contains the entire web page. Contains information

More information

Introduction to WEB PROGRAMMING

Introduction to WEB PROGRAMMING Introduction to WEB PROGRAMMING Web Languages: Overview HTML CSS JavaScript content structure look & feel transitions/animation s (CSS3) interaction animation server communication Full-Stack Web Frameworks

More information

HTML and CSS a further introduction

HTML and CSS a further introduction HTML and CSS a further introduction By now you should be familiar with HTML and CSS and what they are, HTML dictates the structure of a page, CSS dictates how it looks. This tutorial will teach you a few

More information

Table of Contents Chapter 9. Working with Cascading Style Sheets ... 1

Table of Contents Chapter 9. Working with Cascading Style Sheets ... 1 Table of Contents Chapter 9.... 1 Introduction... 1 Introducing Cascading Style Sheets... 2 Create CSS Styles... 2 Attribute Styles... 2 Style Types... 3 Creating a Web Page with a CSS Layout... 4 Create

More information

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100 Introduction to Multimedia MMP100 Spring 2016 profehagan@gmail.com thiserichagan.com/mmp100 Troubleshooting Check your tags! Do you have a start AND end tags? Does everything match? Check your syntax!

More information

Module 2 (VII): CSS [Part 4]

Module 2 (VII): CSS [Part 4] INTERNET & WEB APPLICATION DEVELOPMENT SWE 444 Fall Semester 2008-2009 (081) Module 2 (VII): CSS [Part 4] Dr. El-Sayed El-Alfy Computer Science Department King Fahd University of Petroleum and Minerals

More information

ID1354 Internet Applications

ID1354 Internet Applications ID1354 Internet Applications CSS Leif Lindbäck, Nima Dokoohaki leifl@kth.se, nimad@kth.se SCS/ICT/KTH What is CSS? - Cascading Style Sheets, CSS provide the means to control and change presentation of

More information

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web HTML & CSS SWE 432, Fall 2017 Design and Implementation of Software for the Web HTML: HyperText Markup Language LaToza Language for describing structure of a document Denotes hierarchy of elements What

More information

Guidelines for doing the short exercises

Guidelines for doing the short exercises 1 Short exercises for Murach s HTML5 and CSS Guidelines for doing the short exercises Do the exercise steps in sequence. That way, you will work from the most important tasks to the least important. Feel

More information

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST GIMP WEB 2.0 MENUS Web 2.0 Menus: Horizontal Navigation Bar WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR Hover effect: CREATING AN HTML LIST Most horizontal or vertical navigation bars begin with a simple

More information

Creating a CSS driven menu system Part 1

Creating a CSS driven menu system Part 1 Creating a CSS driven menu system Part 1 How many times do we see in forum pages the cry; I ve tried using Suckerfish, I ve started with Suckerfish and made some minor changes but can t get it to work.

More information

CSS worksheet. JMC 105 Drake University

CSS worksheet. JMC 105 Drake University CSS worksheet JMC 105 Drake University 1. Download the css-site.zip file from the class blog and expand the files. You ll notice that you have an images folder with three images inside and an index.html

More information

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

<body bgcolor=  fgcolor=  link=  vlink=  alink= > These body attributes have now been deprecated, and should not be used in XHTML. CSS Formatting Background When HTML became popular among users who were not scientists, the limited formatting offered by the built-in tags was not enough for users who wanted a more artistic layout. Netscape,

More information

HTML and CSS COURSE SYLLABUS

HTML and CSS COURSE SYLLABUS HTML and CSS COURSE SYLLABUS Overview: HTML and CSS go hand in hand for developing flexible, attractively and user friendly websites. HTML (Hyper Text Markup Language) is used to show content on the page

More information

CMPT 165: More CSS Basics

CMPT 165: More CSS Basics CMPT 165: More CSS Basics Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University October 14, 2011 1 The Favorites Icon The favorites icon (favicon) is the small icon you see

More information

COMSC-031 Web Site Development- Part 2

COMSC-031 Web Site Development- Part 2 COMSC-031 Web Site Development- Part 2 Part-Time Instructor: Joenil Mistal December 5, 2013 Chapter 13 13 Designing a Web Site with CSS In addition to creating styles for text, you can use CSS to create

More information

First Name Last Name CS-081 March 23, 2010 Midterm Exam

First Name Last Name CS-081 March 23, 2010 Midterm Exam First Name Last Name CS-081 March 23, 2010 Midterm Exam Instructions: For multiple choice questions, circle the letter of the one best choice unless the question explicitly states that it might have multiple

More information

Web Design and Implementation

Web Design and Implementation Study Guide 3 - HTML and CSS - Chap. 13-15 Name: Alexia Bernardo Due: Start of class - first day of week 5 Your HTML files must be zipped and handed in to the Study Guide 3 dropbox. Chapter 13 - Boxes

More information

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

CSS3 Basics. From   & CSS Visual Dictionary Learning Curve Books, LLC CSS3 Basics From www.w3schools.com & CSS Visual Dictionary Learning Curve Books, LLC CSS Box Model Margin (top, right, bottom, left) Shorthand property, equivalent to Border-width border-style border-color

More information

Block & Inline Elements

Block & Inline Elements Block & Inline Elements Every tag in HTML can classified as a block or inline element. > Block elements always start on a new line (Paragraph, List items, Blockquotes, Tables) > Inline elements do not

More information

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style precedence and style inheritance Understand the CSS use

More information

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES CLASS :: 13 12.01 2014 AGENDA SIMPLE CSS MENU W/ HOVER EFFECTS :: The Nav Element :: Styling the Nav :: UL, LI, and Anchor Elements :: Styling the UL and LI Elements TEMPLATE CREATION :: Why Templates?

More information

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB Unit 3 Cascading Style Sheets (CSS) Slides based on course material SFU Icons their respective owners 1 Learning Objectives In this unit you

More information

Assignments (4) Assessment as per Schedule (2)

Assignments (4) Assessment as per Schedule (2) Specification (6) Readability (4) Assignments (4) Assessment as per Schedule (2) Oral (4) Total (20) Sign of Faculty Assignment No. 02 Date of Performance:. Title: To apply various CSS properties like

More information

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors Unit 10 - Client Side Customisation of Web Pages Week 5 Lesson 1 CSS - Selectors Last Time CSS box model Concept of identity - id Objectives Selectors the short story (or maybe not) Web page make-over!

More information

The default style for an unordered (bulleted) list is the bullet, or dot. You can change the style to either a square or a circle as follows:

The default style for an unordered (bulleted) list is the bullet, or dot. You can change the style to either a square or a circle as follows: CSS Tutorial Part 2: Lists: The default style for an unordered (bulleted) list is the bullet, or dot. You can change the style to either a square or a circle as follows: ul { list-style-type: circle; or

More information

Creating and Building Websites

Creating and Building Websites Creating and Building Websites Stanford University Continuing Studies CS 21 Mark Branom branom@alumni.stanford.edu Course Web Site: http://web.stanford.edu/group/csp/cs21 Week 6 Slide 1 of 28 Week 6 Agenda

More information

APPLIED COMPUTING 1P01 Fluency with Technology

APPLIED COMPUTING 1P01 Fluency with Technology APPLIED COMPUTING 1P01 Fluency with Technology Cascading Style Sheets (CSS) APCO/IASC 1P01 Brock University Brock University (APCO/IASC 1P01) Cascading Style Sheets (CSS) 1 / 39 HTML Remember web pages?

More information

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148 Index Numbers & Symbols (angle brackets), in HTML, 47 : (colon), in CSS, 96 {} (curly brackets), in CSS, 75, 96. (dot), in CSS, 89, 102 # (hash mark), in CSS, 87 88, 99 % (percent) font size, in CSS,

More information

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents 3.1 Introduction - The CSS1 specification was developed in 1996 - CSS2 was released in 1998 - CSS3 is on its way - CSSs provide the means to control and change presentation of HTML documents - CSS is not

More information

Before you begin, make sure you have the images for these exercises saved in the location where you intend to create the Nuklear Family Website.

Before you begin, make sure you have the images for these exercises saved in the location where you intend to create the Nuklear Family Website. 9 Now it s time to challenge the serious web developers among you. In this section we will create a website that will bring together skills learned in all of the previous exercises. In many sections, rather

More information

ITNP43: HTML Lecture 4

ITNP43: HTML Lecture 4 ITNP43: HTML Lecture 4 Niederst, Part III (3rd edn) 1 Style versus Content HTML purists insist that style should be separate from content and structure HTML was only designed to specify the structure and

More information

3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal />

3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal /> 1. Decide whether each of these forms should be sent via the GET or POST method: A form for accessing your bank account online A form for sending t-shirt artwork to the printer A form for searching archived

More information

CSS Cascading Style Sheets

CSS Cascading Style Sheets CSS Cascading Style Sheets site root index.html about.html services.html stylesheet.css images boris.jpg Types of CSS External Internal Inline External CSS An external style sheet is a text document with

More information

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

Session 4. Style Sheets (CSS) Reading & References.   A reference containing tables of CSS properties Session 4 Style Sheets (CSS) 1 Reading Reading & References en.wikipedia.org/wiki/css Style Sheet Tutorials www.htmldog.com/guides/cssbeginner/ A reference containing tables of CSS properties web.simmons.edu/~grabiner/comm244/weekthree/css-basic-properties.html

More information

YouTube Break. https://www.youtube.com/watch?v=lvtfd_rj2he

YouTube Break. https://www.youtube.com/watch?v=lvtfd_rj2he Layout Jeff Avery YouTube Break https://www.youtube.com/watch?v=lvtfd_rj2he Positioning Visual Components Previously, we learned about event handling and model-view-control architecture. Next, we need

More information

Cascading Style Sheets CSCI 311

Cascading Style Sheets CSCI 311 Cascading Style Sheets CSCI 311 Learning Objectives Learn how to use CSS to style the page Learn to separate style from structure Styling with CSS Structure is separated from style in HTML5 CSS (Cascading

More information

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework Presented by Roel Fermont 1 Today more than ever, Cascading Style Sheets (CSS) have a dominant place in online business. CSS

More information

Cascading Style Sheets Level 2

Cascading Style Sheets Level 2 Cascading Style Sheets Level 2 Course Objectives, Session 1 Level 1 Quick Review Chapter 6 Revisit: Web Fonts Chapter 8: Adding Graphics to Web Pages Chapter 9: Sprucing Up Your Site s Navigation Begin

More information

Getting Started with Eric Meyer's CSS Sculptor 1.0

Getting Started with Eric Meyer's CSS Sculptor 1.0 Getting Started with Eric Meyer's CSS Sculptor 1.0 Eric Meyer s CSS Sculptor is a flexible, powerful tool for generating highly customized Web standards based CSS layouts. With CSS Sculptor, you can quickly

More information

GoSquared Equally Rounded Corners Equally Rounded Corners -webkit-border-radius -moz-border-radius border-radius Box Shadow Box Shadow -webkit-box-shadow x-offset, y-offset, blur, color Webkit Firefox

More information

Web Design and Development Tutorial 03

Web Design and Development Tutorial 03 Table of Contents Web Design & Development - Tutorial 03... 2 Using and Applying CSS to XHTML... 2 Conventions... 2 What you need for this tutorial... 2 Common Terminology... 3 Parent / Child Elements...

More information

CASCADING STYLESHEETS

CASCADING STYLESHEETS CASCADING STYLESHEETS Cascading StyleSheets (CSS) has been mainly created because HTML is just not the right tool for precision and flexibility. HTML is not a very effective for designing web pages. Most

More information

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1 Make a Website A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1 Overview Course outcome: You'll build four simple websites using web

More information

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1 59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xi Introduction xxiii Chapter 1: Creating Structured Documents 1 A Web of Structured Documents 1 Introducing XHTML 2 Core Elements and Attributes 9 The

More information

CSC309 Tutorial CSS & XHTML

CSC309 Tutorial CSS & XHTML CSC309 Tutorial CSS & XHTML Lei Jiang January 27, 2003 1 CSS CSC309 Tutorial --CSS & XHTML 2 Sampel XML Document

More information

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model) INTRO TO CSS RECAP HTML WHAT IS CSS ADDING CSS TO YOUR HTML DOCUMENT CSS IN THE DIRECTORY TREE CSS RULES A FEW CSS VALUES (colour, size and the box model) CSS SELECTORS SPECIFICITY WEEK 1 HTML In Week

More information

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles Using Dreamweaver CC 6 So far we have used CSS to arrange the elements on our web page. We have also used CSS for some limited formatting. In this section we will take full advantage of using CSS to format

More information

IMY 110 Theme 6 Cascading Style Sheets

IMY 110 Theme 6 Cascading Style Sheets IMY 110 Theme 6 Cascading Style Sheets 1. Cascading Style Sheets 1.1. Cascading Style Sheets Up to now we have done styling by using the style attribute. e.g. paragraph What

More information

TUTORIAL MADCAP FLARE Tripane and PDF

TUTORIAL MADCAP FLARE Tripane and PDF TUTORIAL MADCAP FLARE 2018 Tripane and PDF Copyright 2018 MadCap Software. All rights reserved. Information in this document is subject to change without notice. The software described in this document

More information

This tutorial will help both students as well as professionals who want to make their websites or personal blogs more attractive.

This tutorial will help both students as well as professionals who want to make their websites or personal blogs more attractive. About the Tutorial CSS is used to control the style of a web document in a simple and easy way. CSS stands for Cascading Style Sheets. This tutorial covers both the versions CSS1 and CSS2 and gives a complete

More information

Zen Garden. CSS Zen Garden

Zen Garden. CSS Zen Garden CSS Patrick Behr CSS HTML = content CSS = display It s important to keep them separated Less code in your HTML Easy maintenance Allows for different mediums Desktop Mobile Print Braille Zen Garden CSS

More information

Cascade Stylesheets (CSS)

Cascade Stylesheets (CSS) Previous versions: David Benavides and Amador Durán Toro (noviembre 2006) Last revision: Manuel Resinas (october 2007) Tiempo: 2h escuela técnica superior de ingeniería informática Departamento de Lenguajes

More information

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values 3.1 Introduction - HTML is primarily concerned with content, rather than style - However, tags have presentation properties, for which browsers have default values - The CSS1 cascading style sheet specification

More information

COMP519 Web Programming Lecture 7: Cascading Style Sheets: Part 3 Handouts

COMP519 Web Programming Lecture 7: Cascading Style Sheets: Part 3 Handouts COMP519 Web Programming Lecture 7: Cascading Style Sheets: Part 3 Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University

More information

Interview Question & Answers

Interview Question & Answers BASIC Interview Question & Answers OUR TRAINING YOUR CARRER QUESTIONS & ANSWERS OF HTML Ques: - What are the five possible values for position? Ans: - Values for position: static, relative, absolute, fixed,

More information

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube {

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube { .hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in;.tube { color: #996600; height: 3in; width: 12in; position: fixed; What is CSS? Cascading Style Sheets CSS is responsible

More information

Positioning in CSS: There are 5 different ways we can set our position:

Positioning in CSS: There are 5 different ways we can set our position: Positioning in CSS: So you know now how to change the color and style of the elements on your webpage but how do we get them exactly where we want them to be placed? There are 5 different ways we can set

More information

Client-Side Web Technologies. CSS Part II

Client-Side Web Technologies. CSS Part II Client-Side Web Technologies CSS Part II Topics Box model and related properties Visual formatting model and related properties The CSS Box Model Describes the rectangular boxes generated for elements

More information