CSS Flashcards
-<-link href=”location” type=”text/css” rel=”stylesheet” /->-
The code for linking an external CSS page to the html page. The href gives the location, the type tells the page that it is a CSS format and should always be “text/css” and rel describes the relationship which will always be “stylesheet”.
-<-style type=”text/css”->- (CSS Code) -<-/style->-
The code for putting an intern CSS stylesheet into an HTML document.
p { color: rgb(100,100,100);} p { color: DarkCyan;} p { color: #ee3e80;}
The three different types of defining color. RGB, name, and hex.
/* */
How to insert comments in CSS.
p { color-background: #ee3e80;}
The attribute for defining the color background of an element.
p.one { background-color: #e4e4e4; opacity: 0.5; } p.two { background-color: rgb(100,100,100, 0.5); }
The opacity attribute indicates the transparency of a color over a parent color. It can be defined by either using the opacity attribute, or you can use RGB and the fourth number will be the alpha number, or the number between 0.0 and 1.0 that gives the percentage of opacity.
p.one {background-color: hsl (0, 0%, 78%);} p.two {background-color: hsla (48, 0%, 0%, 0.5)}
CSS3 provides a new way to identify color called hsl and hsla. The letters stand for Hue, Saturation, Lightness, and Alpha. Hue is the color number in a 360 degree wheel, Saturation is the amount of grey, Lightness is the amount of white and black, and Alpha is the opacity.
p {font-family: Georgia, Times, serif;}
Font-family specifies the font to be used that is already loaded on the users computer. If the first listed font is not on file, then the browser will use the second, and if that is not on file, the browser will use the default for the font type identification at the end.
p {font-size: 12px; } p {font-size: 100%;} p {font-size: 1.3em;}
The font-size sets the size of the font. Use px to define how many pixels the font is. The percentage sets the font size as the percentage of the default font size. If the default for a parent is 50% and the font size of the child is 50%, then the font displayed will be 25% of the default font. The em is used to set the size to the standard size of the letter M.
@font-face { font-family: ‘Name’; src: url(‘location.ttp’);}
For fonts that are not loaded onto a browser, you can insert font-faces for the browser to download. Use the @font-face declaration. Font-family identifies the name of the font, and src gives the location of the font. Sometimes you need to convert font to different formats so that all browsers can use them. After defining the font, then you use the specified font-family in the rest of the CSS code.
p { font-weight: bold;}
Allows you to bold text. You can also set it to normal.
p { font-style: italic;}
Allows you to ad style to the text. There is italicized, normal, and oblique.
p {text-transform: uppercase;}
Text-transform allows you to change how letters are capitalized. Uppercase makes every letter uppercase, lowercase makes every letter lowercase, and capitalize capitalizes the first letter every word.
p {text-decoration: underline;}
The text-decoration attribute allows you to add decorations to the text such as underline, overline, line-through, and blink. Blink is frowned upon, and none is also another option.
p {line-height: 1.5em;}
The line-height attribute sets the spacing of the vertical line. The line-height includes the size of the font and the leading space in between the font sizes. The height can be set in pixels, but it should be set in em so that the spacing relative to the height of the font. A good distance for reading is around 1.4 and 1.5 em.
p {word-spacing: 1em; letter-spacing: 0.2em; }
You can adjust the word-spacing and the letter-spacing of text. The sizing should be done in em format.
p {text-align: center;}
Text-align allows you to adjust the text alignment in the page. The four values are left, center, right, and justify.
p {text-indent: 2-px; text-shadow: 1px 2px 3px #000000;}
Text-indent allows you to set the indent size of the first line in a paragraph. You can also use this for moving headlines off of the page so that they are not visible to the user but they are still included in the html code. The text shadow feature creates a shadow around words. The first value is the position to the left or right, the second value is the position up and down, the third value is the amount of blur and is optional, and the last value is the color of the shadow. This is not supported in IE, but in practically every other browser.
p:first-letter {}
The :first-letter and :first-line code in css is a pseudo element that will only apply to the first letter or the first line of that text element.
:link :visited :hover :active :focus
These pseudo elements allow you to change the way that elements look depending on their interaction. The :link element describes text that has a link. The :visited element describes links that have been visited. The :hover element describes elements that are being hovered over with a curser. The :active elements describes text that is being clicked on. The :focus element describes elements that are in focus. Are items are in focus when they are ready to be used. For example, when curser is inside a text box and ready for entry, the element is said to have focus. Use the a reference for describing links with this.
p { max-width: #px; min-width: #px; max-height: #px; min-height: #px}
The max and min attributes can be used in CSS to tell the box what maximum and what minimum sizes it should be depending on the screen size of the browser. You can use em, px, or percentages to set the sizes. By default the box will be set to fit the contents within.
div { overflow: hidden; } div {overflow: scroll; }
The overflow attribute tells the browser what to do with content that does not fit in the box. The hidden attribute hides the information that does not fit in the box. The scroll attribute allows the user to scroll to see the rest of the content.
p {border-width: thin; }
The border-width attribute specifies the width of the border. You can use values such as thick, thin, and medium. You can also specify in terms of px. You can also get specific and create border widths such as border-top-width, border-right-width, border-bottom-width, and border-left-width.
p {border-style: solid;}
The border-style attribute identifies the style of the border. The following styles in CSS are dotted, dashed, double, groove, ridge, inset, outset, hidden/none. And you can apply different styles to different sides.