By Ryan Stevenson. Guidebook #3 CSS

Size: px
Start display at page:

Download "By Ryan Stevenson. Guidebook #3 CSS"

Transcription

1 By Ryan Stevenson Guidebook #3 CSS

2 Table of Contents 1. How to Use CSS 2. CSS Basics 3. Text Sizes Colors & Other Styling 4. Element Layout Positioning & Sizing 5. Backgrounds & Borders

3 How to Use CSS There are three different ways that you can use CSS: inline, as a dedicated file loaded with a meta tag, and as an HTML tag. Although any one of the three methods will work, I believe it is important to learn all three in case you need to edit CSS code created by someone else. Inline CSS With inline CSS, the code is placed inside of the HTML tag that will be altered by the CSS code. This method is the most straightforward, although it also has some drawbacks and limitations. First, this method tends to create bloated code (more code than what is really needed). This happens because every HTML tag that needs to be altered with CSS needs dedicated inline CSS code to accomplish that. This can result in the same CSS code being repeated many times on a single page, which is the code bloat. When inline CSS code is overused, you can cause web pages to load slower because of the extra data that needs to be loaded. However, this delay from CSS code bloat is honestly fairly minimal because of the small file size for text compared with other things like images. As long as you do not find yourself repeating the same CSS code over and over again on the same page, you can use this method without worry. A major advantage to this method is the ease of use, especially for those just getting started with CSS. The other two methods of using CSS both require additional information in the CSS code to identify the HTML tags that will be altered, while this information isn't needed with inline CSS because the code alters the tag where it is used. To use inline CSS code, you simply use the STYLE attribute on an HTML tag. The value of that attribute is the CSS code. I have provided a brief example of inline CSS code below: <a href=" style="font-weight:bold;color:#ff0000;">ryan Stevenson Plugins</a> Note the STYLE attribute in the HTML code above. The value of that attribute is the CSS code, which is enclosed in double quotes. The basics of this and other CSS code will be explained in more detail in the next chapter. HTML Tag CSS The next method for using CSS is typically used inside of the HEAD tags of a page, but it will still

4 work when used anywhere in your page content as long as it is used before the content you want to alter. This method (and the meta tag method covered next) offers the most control, but this control also requires some extra work to identify the HTML tags that should be altered with the CSS code. To use this method, start with an opening and closing STYLE HTML tag. The opening tag needs the attribute TYPE with a value of text/css. Anything between the STYLE tags will be CSS code. The big difference between this CSS code and the CSS code used for inline CSS is that this code needs identifiers. Identifiers will be discussed in more detail in the CSS basics chapter next. I have provided a brief example of a CSS STYLE tag below: <style type="text/css"> a {font-weight:bold;color:#ff0000;} </style> In the example above, I actually used the exact same CSS coding from the inline example. However, you should notice the letter 'a' at the beginning of the line and the opening and closing brackets around the CSS code: { } The letter 'a' is the identifier for that CSS code, which applies to all of the CSS found between the brackets in front of that identifier. META Tag CSS (Dedicated File) This last method of using CSS is actually considered to be the best to use, simply because it makes for cleaner code by keeping all of the CSS code in a dedicated file that is simply loaded by the page. However, this method also requires the most work and can be the most confusing for beginners to use, especially using WordPress. This method works exactly like the HTML tag method above with one main exception the CSS code for this method is in a dedicated CSS file and is loaded by a META tag. This tag should always be in the HEAD tags of a page. If you are using WordPress, your theme may offer you a way to easily add code to the HEAD tags. I have provided a brief example of a CSS META tag below: <link rel="stylesheet" href=" type="text/css" media="all" />

5 In the example above, I have used the LINK HTML tag to load a CSS file. A few attributes are required for this tag to work. The REL attribute should have a value of stylesheet. The TYPE attribute should have a value of text/css. The value of the HREF attribute is set to the website URL for the CSS file you want to load. Also note the MEDIA attribute with a value of all. This actually controls whether one or more CSS stylesheet is used depending on what is accessing the page. All is the default value, which simply makes this code work for everything that accesses the site. However, you could create multiple CSS files (one for each type of device) and use different values of MEDIA to declare a specific CSS file for each device. These devices can be used as the value of the MEDIA attribute: all, aural, braille, handheld, projection, print, screen, tty, & tv. All, handheld (mobile/touchpad), print, and screen (computer screens) are the most commonly used of these. If I was using the example above to load a CSS file that had the same CSS code from the previous two methods, the example below shows the entire content of that CSS file: a {font-weight:bold;color:#ff0000;} As you can see, the CSS file simply contains the code that was between the STYLE tags in the previous method. In the first method, I mentioned CSS code bloat. Imagine that you had a web page that had 20 links, and you wanted to style them all the same way using CSS. If you used inline CSS code, you would have to repeat that same code in the STYLE attribute of every link. However, by using the HTML tag or META tag method, you could simply have one line of CSS code that changed the style of all of the links on the page (like the example code above does).

6 CSS Basics Now that you know how to load CSS code into a page, it is time to learn the basics of CSS code so you can create your own. CSS Syntax To start, I want to talk about CSS code syntax. Each line of CSS code you write needs to be done in a particular way to avoid errors. I have reproduced example code below from the inline CSS example in the last chapter: <a href=" style="font-weight:bold;color:#ff0000;">ryan Stevenson Plugins</a> I am going to explain this CSS code to you here mainly focusing on the syntax. The CSS code in this example is found between the double quotes for the STYLE attribute. All CSS code can be broken down into basic pieces: a command name, followed by a colon ':', followed by the value for the command, and ending with a semicolon ';'. This CSS code actually includes two different commands: font-weight and color. Notice the ending semicolon after the value for each of those commands. This semicolon separates one command from the next, so it is absolutely essential to use. Technically, the last CSS command in a line of code DOES NOT need a closing semicolon to work, but I highly recommend simply making a habit of putting it at the end of every command value. For the font-weight command in this example, the value is set to bold this simply makes the text be displayed bold (like using a B or STRONG HTML tag). Note that the command and value are separated by a colon, and the value is closed with a semicolon. For the color command, I have set a value of #FF0000. This changes the text color to the value I have set (which is red). This is a hex color code try if you need help with generating the hex color code for a specific color. CSS Identifiers The next thing that you need to learn about CSS is how to use identifiers. When you load your CSS code using a method other than the inline method (either HTML or META tag), you will need to use identifiers to get your code to work. An identifier is added to each line of CSS code so that it knows where to apply that CSS code to the page content, so this is very important.

7 Using an identifier is fairly simple, but understanding how to use them can be a bit more complicated. To use one, simply start your line of CSS code with the identifier, then add a space and an opening curly bracket: { Your CSS code that goes with that identifier then goes after the opening curly bracket. Finally, put a closing curly bracket at the end of your CSS code for that identifier: } Here is the example I used previously for basic CSS code with an identifier: a {font-weight:bold;color:#ff0000;} There are three main types of identifiers that you can use with CSS code: tag identifiers, id identifiers and class identifiers. I have discussed each of these in detail below. Tag Identifiers A tag identifier makes reference to a specific type of HTML tag. When you use this type, all of the CSS code that goes with the identifier will affect every instance of that HTML tag throughout your entire page. The identifier that you use in your CSS code should be the same as the name of the HTML tag that you want to alter. Using the example above, the letter 'a' is the identifier, which is for the HTML tag A (links). You could simply replace the A in the example code with the name of another HTML tag. You are not limited to using simple HTML tag elements either you can actually use identifiers for HTML tags like HTML or BODY (which covers basically the entire page content). ID Identifiers This type of identifier makes reference to the ID attribute value of an HTML tag on your page. The ID attribute value should be unique on any given page, so this particular identifier will only reference one HTML element on your site. To use this identifier, simply use a number symbol '#' followed by the value of the ID attribute that you want to target. Here is some example HTML code for a link that has an ID attribute: <a href=" id="rsplink">ryan Stevenson Plugins</a> If I wanted to make reference to that link in my CSS code with an identifier, I would use the following

8 code (this code uses the same CSS code that I previously used in the other examples): #rsplink {font-weight:bold;color:#ff0000;} As you can see, this looks almost identical to my previous identifier example except that the identifier has changed. #rsplink is the identifier, which references the HTML tag with the ID attribute set to a value of rsplink. Class Identifiers This type of identifier is very similar to the previous identifier, except that it references the CLASS attribute value of an HTML tag. Since a CLASS attribute value can be used many times on a single page, this is an identifier that you can use to reference a specific group of HTML tags that you have created. This could be a single HTML tag but it could also be many of them. To use this identifier, simply use a period '.' followed by the value of the CLASS attribute that you want to target. Here is some example HTML code for a link that has a CLASS attribute: <a href=" class="rsplink">ryan Stevenson Plugins</a> If I wanted to make reference to that link in my CSS code with an identifier, I would use the following code (this code uses the same CSS code that I previously used in the other examples):.rsplink {font-weight:bold;color:#ff0000;} This is almost identical to the ID identifier example, except that this uses a period in front of the identifier name and it makes reference to a CLASS attribute. Combination Identifiers One last identifier that I want to mention isn't really it's own type but a combination of other types. One of the things that makes CSS so powerful is the flexibility of the identifier system. You can actually take multiple identifiers and put them together in one line of CSS code. For example, let's say that you wanted to have CSS code to alter HTML links (A tag). However, maybe you didn't want all of the links on the page altered and didn't want to go through your code to add a

9 class to each tag to use as an identifier. You may actually be able to reference those links in another way using a combination of identifiers. If the links you wanted altered were found within an HTML TABLE tag and it was the only TABLE tag on the whole page, you could use that as a partial identifer. I have created some example code below that uses a combination of identifiers like this: table a {font-weight:bold;color:#ff0000;} As you can see, all I did was put two identifiers in front of the CSS code with a space between the identifiers. This CSS code would then apply to HTML links, but only those located within a table! This same concept can also apply to mixing the identifier types. Using the same example, let's say I have more than one table on my page and only want this code to apply to links in one of the tables. If that one table has an ID attribute set, I can use that as an identifier instead of the general TABLE tag identifier. I have created more sample code below for this situation, where my table has an ID value of rsptable: #rsptable a {font-weight:bold;color:#ff0000;} This concept of using multiple identifiers can also be used with more than two identifiers at a time. I also want to show you another example of using multiple identifiers but in a different way. This can help to reduce your workload and also reduce code bloat. What if you had CSS code that you wanted to apply to two different HTML elements on your page? This can easily be accomplished by simply separating the identifiers with a comma. For the example below, I have applied the same CSS code to more than one element: #rsptable a, div, table td {font-weight:bold;color:#ff0000;} The CSS code above actually alters three different elements: A tags with the ID value of rsptable, div HTML tags, and td tags found within table tags.

10 Text: Sizes, Colors & Other Styling One of the most common things that people want to do with CSS is change the way text is displayed on their site. CSS can be used to easily change text size, colors, fonts, and more. Text Size To set the size of text, use the CSS command font-size. The value can be in em, pixels (px) or a percentage (%). Personally, I use pixels and will be using them in examples in this tutorial. However, em is technically the recommend size unit because of problems that can be experienced in older versions of Internet Explorer using pixels. However, the problems aren't entirely avoided by using em (it has to do with resizing text in the browser). Personally, I just prefer the way pixels are handled in browsers. The size unit em is a relational size to the current font size. The default text size in browsers is 16px, so 1em is equal to 16px. Percentages can be used to fix the IE browser issue completely. Simply set a font-size of 100% for the BODY tag and then use the em size unit for other elements. While this works great on sites you design from scratch yourself, WordPress may not be easily customized to work like this unless the theme you are using is already set up this way. In the long run, the majority of your users will get proper text sizes. Only those using very small or very large text sizes in their browsers will experience sizes that may be a bit larger or smaller than intended, but these users are also likely used to this type of thing with websites. Personally, I will try to change the browser text size myself just to make sure the site text looks OK at any setting. As long as this checks out, there isn't much else to worry about. In general, 16px is considered to be a standard font size, so anything above that will be larger text and anything lower will be smaller text. In the example below, I have set an inline CSS style to change the font size of this link: <a href=" style="font-size:18px;">ryan Stevenson Plugins</a> Note the CSS command, font-size, followed by a colon, then the value (18px) and finally the closing semicolon. Text Weight The CSS alternative for the HTML tags B or STRONG is the command font-weight. A value of normal is the default value (if this command isn't used at all), and a value of bold will make the text bold just like those previous HTML tags. The example below shows the font-weight command in use:

11 <a href=" style="font-weight:bold;">ryan Stevenson <span style="font-weight:normal;">plugins</span></a> In the example above, I set the link text to be bold with the font-weight command. However, I also added a SPAN tag inside of the link to make the word 'Plugins' appear as normal text and not bold. This command can also accept other values to created varied amounts of bold text. Set the value to a number between 100 and 900, but only use increments of 100. For example, 700 produces bold text while 400 produces normal text, so you can see that there are levels both above bold text and below normal text that you can use as well as levels in between. Text Colors To set the color of text, simply use the command color. The value for this command should be a hex color code, which is a number symbol followed by a series of 6 letters/numbers. To generate a color code, try this site: The example code below shows this command being used: <a href=" style="color:#ff0000;">ryan Stevenson <span style="color:#0000ff;">plugins</span></a> In this example, I have used the color command twice. The first one sets the entire link text as the color red (#FF0000). The second one changes just the word 'Plugins' to the color blue (#0000FF). Font Family The command font-family allows you to change the text font by setting the value of the command to the name of a font family. There are generic font families and specific font families that you can use, and both are typically used together because of the way this command works. This command uses a fallback system that allows you to specify more than one font family name. If the first one is not available in a browser, it will attempt to use the next and so on. Instead of simply giving you a list of individual font names, I wanted to provide you with a more practical solution for font families, so I have put together a list of names that you can use, as-is. Each item in this list includes 2-4 font family names, so you can use the whole line for the value of this command. Sans-Serif Fonts

12 Arial, Helvetica, sans-serif 'Arial Black', Gadget, sans-serif 'Comic Sans MS', cursive, sans-serif Impact, Charcoal, sans-serif Tahoma, Geneva, sans-serif 'Trebuchet MS', Helvetica, sans-serif Verdana, Geneva, sans-serif Serif Fonts Georgia, serif 'Palatino Linotype', 'Book Antiqua', Palatino, serif 'Times New Roman', Times, serif Monospace Fonts 'Courier New', Courier, monospace 'Lucida Console', Monaco, monospace I have provided an example of the font-family command below, where I have used one of the lists of font families from above: <a href=" style="font-family:'trebuchet MS', Helvetica, sans-serif;">ryan Stevenson Plugins</a> Notice how I use single quotes around the font family names that are more than one word long. Technically, you could also use double quotes here, but you have to be sure that they won't cause an error because of mismatched quotes. In this example, I have used inline CSS code with my HTML. The HTML attributes are using double quotes, so it is very important for my CSS to only use single quotes. Otherwise, HTML would interpret the first double quote as the close of the style attribute, which would cut off the real CSS code and cause things to not work as expected. Font Style The CSS alternative for the HTML tags I and EM is the command font-style. With a value of normal, this command simply displays standard text, but with a value of italic or oblique it will display italic text. The oblique value provides text that is slanted more than italic text. I have provided an example below:

13 <a href=" style="font-style:italic;">ryan Stevenson <span style="font-weight:oblique;">plugins</span></a> In this example, the text in the link is made italic, but the words 'Plugins' is made oblique (more slanted italics). Small Caps Text Another simple CSS command that I really like to use is font-variant. With the value set to normal, this command just produces standard text, but with the value set to small-caps it will make text all capital letters with the lowercase letters being smaller capital letters. I have provided an example of this command below: <a href=" style="font-variant:small-caps;">ryan Stevenson Plugins</a> In this example, I have simply set the link text to display with the small-caps font variant. List Styles With HTML lists, the default marker for list items can be changed with the CSS command list-styletype. There are more than 20 different values that can be used for this command, so I will just be listing some of the most commonly used along with a brief description of the marker that each value creates: circle A hollow circle. decimal Ascending numbers (default for OL lists). decimal-leading-zero Ascending numbers with a leading zero for numbers under 10 disc A filled circle (default for UL lists). inherit These lists will inherit the value from the parent element/list (this value can be used with many CSS commands). lower-alpha Lowercase letters. lower-roman Lowercase roman numerals. none No marker. square A filled square. upper-alpha Uppercase letters. upper-roman Uppercase roman numerals.

14 This CSS command should be used on the UL and/or OL tags that are used to create lists. Here is an example of an ordered list that is using uppercase roman numerals instead of the default numbering: <ol style= list-style-type:upper-roman; > <li>first List Item</li> <li>second List Item</li> </ol> This would display like: I. First List Item II. Second List Item List Marker Images Instead of using one of the predefined list image styles, you can also set your own using an image file. This is done with the list-style command. To use this command, you will need to have the website address of the image file you want to use as the marker. This goes in the value of the list-style command, along with a url wrapper. You can also provide a default list-style-type to use with this command, in case the URL doesn't load for any reason. An example of this command is below: <ul style= list-style:disc url(' > <li>first List Item</li> <li>second List Item</li> </ul>

15 Element Layout, Positioning & Sizing One of the most common things that I find myself using CSS to do on my websites is to control the layout and/or size of various HTML elements on the page. A number of CSS commands are available that allow you to do this, so I will be discussing those with you in this chapter. Element Size In general, if you want to have an HTML element on your page in a specific place, you will need to size your elements properly to get everything to line up how you want. Two primary CSS commands can be used to accomplish this: height and width. For either command, simply set a value as a number of pixels (px) or a percentage of the parent element. Without these commands, an HTML element will automatically size itself. Block elements like DIV tags will always take up 100% width unless otherwise specified, but the height of a DIV element is automatically calculated based on the amount of content in it. Inline elements will size the width to the content automatically. I will commonly use the DIV tag to create the layout of my entire website, so the height and width commands are very important to control the size of these elements so they are not automatically sized for me. I have provided an example of these two commands below, where I have set both the height and width of a DIV tag to be 250px: <div style="height:250px;width:250px;">text Content</div> Element Layout When you create DIV tags that have specific widths, they will still line up one on top of the other even if there is enough space for them to line up next to each other. This happens because DIV tags are block elements. You can change this default behavior with CSS to make DIV tags line up next to each other instead with the command float. When you set the value of this command to left or right, you are forcing the DIV tag to become an inline element. A value of left causes the element to align to the left and right causes the element to align to the right both of these alignments take place within the available work space and not necessarily within the scope of the entire page. By using this one command with sized DIV tags, you can cause the tags to line up next to each other (just be sure there is enough horizontal space in the page to accommodate the tags). I have provided an example of this below:

16 <div style="height:250px;width:250px;float:left;">text Content #1</div> <div style="height:250px;width:250px;float:left;">text Content #2</div> As you can see, both elements use a float value of left. This causes them to line up directly next to each other without space between them. As I mentioned before, you simply need enough horizontal space to hold the elements. If there is not enough horizontal space, the elements will simply start on a new line. I have provided another example below that shows how this works: <div style="width:500px;"> <div style="height:250px;width:250px;float:left;">text Content #1</div> <div style="height:250px;width:250px;float:left;">text Content #2</div> <div style="height:250px;width:250px;float:left;">text Content #3</div> <div style="height:250px;width:250px;float:left;">text Content #4</div> </div> In this example, I have four DIV tags contained within another DIV tag. The parent DIV tag is 500 pixels wide, while each of the children tags are 250 pixels wide and set to float to the left. Since there is only 500 pixels of total width for these DIV tags to float within, there is only room on a single line for two of the DIV tags. As a result, the second two DIV tags would automatically drop to the second line. This would essentially create a 2x2 grid of DIV tags on the page. It is very important to remember that anytime you use a float, you must also clear that float once you are done with it! This is done with the clear command. You can use a value of both to clear both floats, or you can simply use a value of either left or right to just clear one float. I have provided two different examples below to show you what happens when you don't clear a float: Example #1 Float NOT Cleared: <div style="height:250px;width:250px;float:left;">text Content #1</div>Page Content This example might look like this: Text Content #1 Page Content Example #2 Float Cleared:

17 <div style="height:250px;width:250px;float:left;">text Content #1</div><div style="clear:both;"></div>page Content This example might look like this: Text Content #1 Page Content As you can see from this example, clearing the float prevents anything from showing up on the same line as the floated element(s). Without clearing the float, the next element/text will still show up as an inline element. Element Positioning CSS also provides an easy way to position your elements on the page. This can be especially useful for special situations where you want an HTML element to behave abnormally on your page. A great example of this is the black WordPress toolbar that is at the top of the page when you are logged into a WordPress site. Ever notice how this toolbar is always at the very top of the page, even when you scroll down the page? This is accomplished with CSS positioning using three commands: position, left and top. The position command defaults to the value of static, which makes an element show up as normal. The fixed value positions the element relative to the browser window. The relative value positions the element relative to its normal location on the page. The absolute value positions the element relative to the first non-static positioned parent element on the page. The commands left and top are used with a value in pixels (px) that represents how much space to offset the element according to the positioning rules that are set for it (because of the position command value). The easiest way to understand positioning is with an example: <div style="position:fixed;left:0px;top:0px;">text Content #1</div> This element is set to a fixed position with both a left and top value of 0 pixels. This causes the element to get displayed at the top of the page at all times (just like the WordPress admin toolbar I mentioned before). I have created another example below to go a bit deeper into positioning with CSS:

18 <div style="position:relative;left:100px;top:0px;"> Text Content #1 <div style="position:absolute;left:-100px;top:0px;"> Text Content #2 </div> </div> This might display like: Text Content #2Text Content #1 In this example, I have two DIV tags, both using the position command. The first DIV is using a value of relative. With a left value of 100px and a top value of 0px, this element will be moved 100 pixels to the right in the content relative to its normal position on the page. The second DIV element is using a value of absolute for the position, which causes its position to be relative to the first parent element with a non-static position (the first DIV, in this case). With a left value of -100px and a top value of 0px, this second DIV will show up 100 pixels to the left of the first DIV element. Element Padding & Margins Without CSS coding, elements like DIV tags will not have any padding or margins. The lack of margins allows the DIV tags to sit directly against other DIV tags. This can be convenient to use when building a site layout, but there are other times when you will want to have margins to provide some space between elements. The easiest way to understand margins and padding is to think of margins as being the spacing outside of an element and padding as being spacing inside of an element. To create a margin around the outside of an element, use the margin CSS command. The value should be a number of pixels, which is the amount of space added to the outside of the element on all sides. You can also add margins one at a time with commands like margin-top, margin-bottom, margin-left and margin-right. Padding works the same way except that it is spacing inside of an element and uses the command padding. If your element has a border, padding will show up as spacing between the border and the content in the element. I have created an example below to show padding and margins being used. I have also used the border command in this example so that the padding and margins can be more easily seen. I will explain borders in more detail in the next chapter: <div style="width:250px;height:250px;float:left;margin:5px;padding:5px;border:1px solid #000000;">Text Content #1</div><div

19 style="width:250px;height:250px;float:left;margin:15px;padding:15px;border:1px solid #000000;">Text Content #2</div> This will display like: The first DIV tag has padding and spacing of 5px, while the second has 15px for both. As you can see from the differences between the two, the margin alters where the element is displayed on the page and the padding alters where the content in the element is displayed. Element Layering The z-index command can be used when your page elements are moved on top of each other (using the position command). The z-index command accepts a number as the value, and then elements will be stacked on the page starting with the lowest z-index number and working up to the highest z-index number. Using this command makes it possible to layer your elements instead of forcing everything to sit next to each other. I have created an example below that shows how this works: <div style="height:350px;"> <div style="width:250px;height:250px;margin:5px;padding:5px;border:1px solid

20 #000000;background-color:#CCCCCC;position:relative;left:0px;top:0px;z-index:10;"> Text Content #1 <div style="position:absolute;left:50px;top:50px;z-index:20;width:250px; height:250px;margin:15px;padding:15px;border:1px solid #000000;backgroundcolor:#CCCCCC;"> Text Content #2 </div> </div> </div> This displays like: This example is a total of 3 DIV tags, each one inside of the next. The first DIV is a placeholder that is stretching enough vertical space to contain the other two DIVs. Without this, you would find that some of the content would be cut off from the bottom of the display (at least when used within the content of a WordPress page). The second and third DIVs are very similar to those that I created in the previous example, except that I have positioned these so that one lays on top of the other. I also added a background color (which will be explained in more detail in the next chapter) so that the boxes wouldn't be see-through. The second DIV is positioned relative and does not have its actual position altered (this is needed for positioning the third DIV). The z-index is set to 10 for this DIV.

21 With the third DIV, the position is set to absolute, which sets its position with the parent element. I then move the element to right and down 50 pixels (top:50px and left:50px). With a z-index of 20, this element is displayed on top of the parent element.

22 Backgrounds & Borders By simply adding background colors or images and borders to elements, you can make them appear as though they could be graphics and not designed with HTML/CSS. Ultimately, this type of thing is what makes CSS so powerful to use because it can save you a ton of time and even help you avoid outsourcing for graphics work. Element Borders The border command allows you to create a border around an HTML element. The value for this command requires three parts: an amount of pixels for the width of the border, the border style, and the color of the border. The border style can be any one of a number of possible values that controls how the border looks. I've listed these possible values below and provided a brief description for each: none No border. dotted Dotted line border. dashed Dashed line border. solid Solid line border. double Double line border. groove 3D grooved border. inset 3D inset border. outset 3D outset border. ridge 3D ridged border. I have provided an example of a DIV element with a border around it below: <div style="width:250px;height:250px;float:left;margin:5px;padding:5px;border:1px solid #000000;">Text Content #1</div> The last CSS command in that example creates the border. As you can see, there are three parts to my value and each is separated by a space. The first part of the value is the width of the border in pixels (1px), the second part is the border style name (solid), and the third part is a hex color code that controls the color of the border (#000000). This creates a 1 pixel wide, black, solid line border around the entire element. Besides being used for design purposes, I sometimes use borders for another purpose: troubleshooting. If I am creating a layout with HTML and something isn't lining up right, using borders can be an easy way to figure out what is going wrong. Just add borders to all of your elements to truly see how everything is lining up. I have done this many times and been able to immediately realize what I did wrong after seeing everything with borders.

23 If you remember from margin and padding that you can apply those commands to just one side of your element by adding a hyphen and an additional phrase to the end of each command. The border command works the same way, so you can use border-top, border-bottom, border-left, and/or border-right to apply a border to just one side of an element. Element Backgrounds Setting a solid background color for an element can be done with the background-color command. The value should be a hex color code that controls the background color. The example below uses the previous example with an added background color. The background takes up the height/width of the element and the padding space. <div style="width:250px;height:250px;float:left;margin:5px;padding:5px;border:1px solid #000000;background-color:#CCCCCC;">Text Content #1</div> This example fills the DIV element with a light-grey background color (#CCCCCC). A background can also be set as an image file instead of using a solid color. This allows for a nearly endless variety of design options. By default, a background image will be repeated horizontally and vertically and placed in the top-left corner of an element. You can use the background-image command to show an image this way, but in most cases, this is not how you will want an image to be displayed, so I recommend using the standard background command instead to have more control over the image. The background command actually takes the values of up to 8 different background commands. You can choose to use as many or few of these as needed and use them in any order: background-color, background-position, background-size, background-repeat, background-origin, background-clip, background-attachment, background-image. If you would like to do more complicated things with background images, just search Google for CSS information on any one of those commands to find out more For this tutorial, I want to show you how to use this command to display a background image. I have provided some example code below that shows how this is done: <div style="width:250px;height:250px;float:left;margin:5px;padding:5px;border:1px solid #000000;font-weight:bold;font-size:24px;text-align:center;background:#CCCCCC url(' no-repeat fixed center;">text Content #1</div> In this example, my background command has a total of 5 values in this order: background-color

24 (#CCCCCC), background-image (url(' background-repeat (no-repeat), background-attachment (scroll), and background-position (center). The background-color value is used as a fallback in case the image isn't loaded (a very small percentage of internet users actually have image downloading disabled in their browsers, for example). The background-image value starts with url, then an opening parenthesis and single quote (', then the web address of the image file, and then closes with another single quote and a closing parenthesis '). The background-repeat value is set to no-repeat, which prevents the entire image from being repeated. You could also use repeat as a value to make it repeat both horizontally and vertically. A value of repeat-x makes the image only repeat horizontally, while a value of repeat-y makes it only repeat vertically. The background-attachment value specifies whether the background scrolls with the rest of the page or not. A value of scroll is the default value, which causes the background image to scroll as normal with the element. A value of fixed causes the background to maintain the same position in the window, even when scrolled (this is how pages are created that have a background image that doesn't scroll with the rest of the page). A value of local could also be used to make the background scroll with the elements contents, although this value isn't used too often. Technically, I didn't need to use this because I am using the default value, but I wanted to use it and explain it so you would know how to use it when needed. The background-position value sets the starting position of the background image in the element. The value for this should actually be a two-part value, but I have left off a value because I am using center as my value (an omitted value for this defaults to center). There are a few different types of values that can be used for this two-part value. The first type is a keyword based value: left, right, top, bottom, or center. For example, if I wanted the image to start in the top-right corner of the element, I would use the value of right top. The second type is a numerical value, which can either be in pixels or a percentage (technically, any CSS supported size unit can be used here, like em for example). Any combination of these measuring units can be used, but the first value is for the x position (horizontal) and the second value is for the y position (vertical). For example, the value of 0% 0% or 0px 0px represents the top-left corner of an element and the bottom-right corner is 100% 100%. If one value is left out, it defaults to 50%.

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

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

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

By Ryan Stevenson. Guidebook #2 HTML

By Ryan Stevenson. Guidebook #2 HTML By Ryan Stevenson Guidebook #2 HTML Table of Contents 1. HTML Terminology & Links 2. HTML Image Tags 3. HTML Lists 4. Text Styling 5. Inline & Block Elements 6. HTML Tables 7. HTML Forms HTML Terminology

More information

Adding CSS to your HTML

Adding CSS to your HTML Adding CSS to your HTML Lecture 3 CGS 3066 Fall 2016 September 27, 2016 Making your document pretty CSS is used to add presentation to the HTML document. We have seen 3 ways of adding CSS. In this lecture,

More information

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference Inline Style Syntax: Introduction to Web Design CSS Reference Example: text Internal Style Sheet Syntax: selector {property: value; Example:

More information

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference Inline Style Syntax: Introduction to Web Design CSS Reference Example: text Internal Style Sheet Syntax: selector {property: value; Example:

More information

Reading 2.2 Cascading Style Sheets

Reading 2.2 Cascading Style Sheets Reading 2.2 Cascading Style Sheets By Multiple authors, see citation after each section What is Cascading Style Sheets (CSS)? Cascading Style Sheets (CSS) is a style sheet language used for describing

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

HTML/XML. HTML Continued Introduction to CSS

HTML/XML. HTML Continued Introduction to CSS HTML/XML HTML Continued Introduction to CSS Entities Special Characters Symbols such as +, -, %, and & are used frequently. Not all Web browsers display these symbols correctly. HTML uses a little computer

More information

Introduction to Web Tech and Programming

Introduction to Web Tech and Programming Introduction to Web Tech and Programming Cascading Style Sheets Designed to facilitate separation of content and presentation from a document Allows easy modification of style for an entire page or an

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

<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

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

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

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

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

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets 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

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

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

Controlling Appearance the Old Way

Controlling Appearance the Old Way Webpages and Websites CSS Controlling Appearance the Old Way Older webpages use predefined tags - - italic text; - bold text attributes - Tables (and a few other elements) use specialized

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

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations). WDI Fundamentals Unit 4 CSS Cheat Sheet Rule The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations). Declaration A declaration is made

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

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

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet. CSS Tutorial Part 1: Introduction: CSS adds style to tags in your html page. With HTML you told the browser what things were (e.g., this is a paragraph). Now you are telling the browser how things look

More information

1 of 7 11/12/2009 9:29 AM

1 of 7 11/12/2009 9:29 AM 1 of 7 11/12/2009 9:29 AM Home Beginner Tutorials First Website Guide HTML Tutorial CSS Tutorial XML Tutorial Web Host Guide SQL Tutorial Advanced Tutorials Javascript Tutorial PHP Tutorial MySQL Tutorial

More information

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo Note: We skipped Study Guide 1. If you d like to review it, I place a copy here: https:// people.rit.edu/~nbbigm/studyguides/sg-1.docx

More information

Cascading Style Sheet Quick Reference

Cascading Style Sheet Quick Reference Computer Technology 8/9 Cascading Style Sheet Quick Reference Properties Properties are listed in alphabetical order. Each property has examples of possible values. Properties are not listed if they are

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

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

Azon Master Class. By Ryan Stevenson Guidebook #8 Site Construction 1/3

Azon Master Class. By Ryan Stevenson   Guidebook #8 Site Construction 1/3 Azon Master Class By Ryan Stevenson https://ryanstevensonplugins.com/ Guidebook #8 Site Construction 1/3 Table of Contents 1. Code Generators 2. Home Page Menu Creation 3. Category Page Menu Creation 4.

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

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

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

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

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

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

> > > > Cascading Style Sheets basics

> > > > Cascading Style Sheets basics > > > > Cascading Style Sheets basics CSS A style language used to control the design layout of an.html or.php document more efficiently and globally than using HTML attributes. Good Stuff Gives you greater

More information

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson CSS: Formatting Text 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 text processing: font-family

More information

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling EECS1012 Net-centric Introduction to Computing Lecture 3: CSS for Styling Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.

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

TAG STYLE SELECTORS. div Think of this as a box that contains things, such as text or images. It can also just be a

TAG STYLE SELECTORS. div Think of this as a box that contains things, such as text or images. It can also just be a > > > > CSS Box Model Think of this as a box that contains things, such as text or images. It can also just be a box, that has a border or not. You don't have to use a, you can apply the box model to any

More information

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) Web Development & Design Foundations with HTML5 Ninth Edition Chapter 3 Configuring Color and Text with CSS Slides in this presentation contain hyperlinks. JAWS users should be able to get a list of links

More information

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

Downloads: Google Chrome Browser (Free) -   Adobe Brackets (Free) - Week One Tools The Basics: Windows - Notepad Mac - Text Edit Downloads: Google Chrome Browser (Free) - www.google.com/chrome/ Adobe Brackets (Free) - www.brackets.io Our work over the next 6 weeks will

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

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

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

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

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options): CSS Tutorial Part 1: Introduction: CSS adds style to tags in your html page. With HTML you told the browser what things were (e.g., this is a paragraph). Now you are telling the browser how things look

More information

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em> Introduction to CSS Review Question 1 Which tag is used to create a link to another page? 1. 2. 3. 4. Review Question 1 Which tag is used to create a link to another page? 1. 2.

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 3 Slide 1 of 16 Week 3 Agenda

More information

escuela técnica superior de ingeniería informática

escuela técnica superior de ingeniería informática Tiempo: 2h escuela técnica superior de ingeniería informática Previous versions: David Benavides and Amador Durán Toro (noviembre 2006) Manuel Resinas (october 2007) Last revision:pablo Fernandez, Cambios

More information

CSS BASICS. selector { property: value; }

CSS BASICS. selector { property: value; } GETTING STARTED 1. Download the Juice-o-Rama 11-01 zip file from our course dropbox. 2. Move the file to the desktop. You have learned two ways to do this. 3. Unzip the file by double clicking it. You

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

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions Text and Layout Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11 This presentation 344 345 Text in Graphics Maximum flexibility obtained by treating text as graphics and manipulating

More information

Azon Master Class. By Ryan Stevenson Guidebook #7 Site Construction 2/3

Azon Master Class. By Ryan Stevenson   Guidebook #7 Site Construction 2/3 Azon Master Class By Ryan Stevenson https://ryanstevensonplugins.com/ Guidebook #7 Site Construction 2/3 Table of Contents 1. Creation of Site Pages 2. Category Pages Creation 3. Home Page Creation Creation

More information

CSS means Cascading Style Sheets. It is used to style HTML documents.

CSS means Cascading Style Sheets. It is used to style HTML documents. CSS CSS means Cascading Style Sheets. It is used to style HTML documents. Like we mentioned in the HTML tutorial, CSS can be embedded in the HTML document but it's better, easier and neater if you style

More information

To link to an external stylesheet, the link element is placed within the head of the html page:

To link to an external stylesheet, the link element is placed within the head of the html page: CSS Basics An external style sheet is simply a text file (use BBEdit or Textwrangler) containing style rules, saved with the.css extension. It s best practice to keep style sheets for a site grouped within

More information

CSc 337 LECTURE 3: CSS

CSc 337 LECTURE 3: CSS CSc 337 LECTURE 3: CSS The bad way to produce styles welcome to Greasy Joe's. You will never, ever, ever beat our

More information

Azon Master Class. By Ryan Stevenson Guidebook #7 Site Construction 2/2

Azon Master Class. By Ryan Stevenson   Guidebook #7 Site Construction 2/2 Azon Master Class By Ryan Stevenson https://ryanstevensonplugins.com/ Guidebook #7 Site Construction 2/2 Table of Contents 1. Creation of Additional Site Pages & Content 2. Custom HTML Menus for Category

More information

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

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CSS. Lecture 16 COMPSCI 111/111G SS 2018 CSS Lecture 16 COMPSCI 111/111G SS 2018 No CSS Styles A style changes the way the HTML code is displayed Same page displayed using different styles http://csszengarden.com Same page with a style sheet

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

Chapter 12: FORMATTING TEXT

Chapter 12: FORMATTING TEXT Disclaimer: All words, pictures are adopted from Learning Web Design (3 rd eds.) by Jennifer Niederst Robbins, published by O Reilly 2007. PART III: CSS FOR PRESENTATION Chapter 12: FORMATTING TEXT CSc2320

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

In the early days of the Web, designers just had the original 91 HTML tags to work with.

In the early days of the Web, designers just had the original 91 HTML tags to work with. Web Design Lesson 4 Cascading Style Sheets In the early days of the Web, designers just had the original 91 HTML tags to work with. Using HTML, they could make headings, paragraphs, and basic text formatting,

More information

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Week 7 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 Cascading Style Sheets (CSS) Examples of CSS CSS provides a powerful and stillevolving toolkit of style

More information

Web Site Design and Development Lecture 6

Web Site Design and Development Lecture 6 Web Site Design and Development Lecture 6 CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM Inheritance Before we talk about font properties, it needs to be known that font properties are inherited by the descendants

More information

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013 UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013 SUBJECT CODE : SCSV1223 (Section 05) SUBJECT NAME : WEB PROGRAMMING YEAR/COURSE : 1SCSV TIME : 2.00 4.00 PM DATE : 18 APRIL 2013 VENUE : KPU 10

More information

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015 Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS 8 Oct 2015 What is CSS? o CSS (Style Sheet) defines how HTML elements are formatted and displayed. o It helps you easily change an HTML

More information

CSS Lecture 16 COMPSCI 111/111G SS 2018

CSS Lecture 16 COMPSCI 111/111G SS 2018 No CSS CSS Lecture 16 COMPSCI 111/111G SS 2018 Styles Astyle changes the way the HTML code is displayed Same page displayed using different styles Same page with a style sheet body font-family: sans-serif;

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

Introduction to Cascading Style Sheets

Introduction to Cascading Style Sheets Introduction to Cascading Style Sheets Welcome to the CSS workshop! Before you begin this workshop you should have some basic understanding of HTML and building web pages. What is CSS anyway and what will

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

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub!

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub! When you're all done, the format will look like this: Hey! Make With The Style Sheet Already, Bub! This

More information

Styles, Style Sheets, the Box Model and Liquid Layout

Styles, Style Sheets, the Box Model and Liquid Layout Styles, Style Sheets, the Box Model and Liquid Layout This session will guide you through examples of how styles and Cascading Style Sheets (CSS) may be used in your Web pages to simplify maintenance of

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

CSC309 Programming on the Web week 3: css, rwd

CSC309 Programming on the Web week 3: css, rwd CSC309 Programming on the Web week 3: css, rwd Amir H. Chinaei, Spring 2017 Office Hours: M 3:45-5:45 BA4222 ahchinaei@cs.toronto.edu http://www.cs.toronto.edu/~ahchinaei/ survey 1 in survey 1, you provide

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

HTML Tags <tag>stuff</tag>

HTML Tags <tag>stuff</tag> HTML Tags stuff a address blockquote body br div em h1, h2, h3, h4, h5 & h6 head html img li link ol p span strong style title ul Find The Whole Shebang on htmldog.com (anchor) used for links

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

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

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

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

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

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS cristina gena dipartimento di informatica cgena@di.unito.it http://www.di.unito.it/~cgena/ materiale e info sul corso http://www.di.unito.it/~cgena/teaching.html

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

CSS. Text & Font Properties. Copyright DevelopIntelligence LLC

CSS. Text & Font Properties. Copyright DevelopIntelligence LLC CSS Text & Font Properties 1 text-indent - sets amount of indentation for first line of text value: length measurement inherit default: 0 applies to: block-level elements and table cells inherits: yes

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

Using CSS in Web Site Design

Using CSS in Web Site Design Question 1: What are some of the main CSS commands I should memorize? Answer 1: The most important part of understanding the CSS language is learning the basic structure and syntax so you can use the language

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

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

Internet Programming 1 ITG 212 / A

Internet Programming 1 ITG 212 / A Internet Programming 1 ITG 212 / A Lecture 10: Cascading Style Sheets Page Layout Part 2 1 1 The CSS Box Model top margin top border top padding left margin left border left padding Content right padding

More information

Cascading Style Sheets. Overview and Basic use of CSS

Cascading Style Sheets. Overview and Basic use of CSS Cascading Style Sheets Overview and Basic use of CSS What are Style Sheets? A World Wide Web Consortium (W3C) defined standard A way for web page designers to separate the formatting of a document from

More information

Introduction to Computer Science Web Development

Introduction to Computer Science Web Development Introduction to Computer Science Web Development Flavio Esposito http://cs.slu.edu/~esposito/teaching/1080/ Lecture 9 Lecture Outline Text Styling Some useful CSS properties The Box Model essential to

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

IDM 221. Web Design I. IDM 221: Web Authoring I 1

IDM 221. Web Design I. IDM 221: Web Authoring I 1 IDM 221 Web Design I IDM 221: Web Authoring I 1 Week 5 IDM 221: Web Authoring I 2 Working With Text IDM 221: Web Authoring I 3 Special Characters IDM 221: Web Authoring I 4 > < & IDM 221: Web Authoring

More information