reading-notes


Project maintained by Razan-am Hosted on GitHub Pages — Theme by mattgraham

CSS

Chapter 5: “Images”

1. Choosing Images for Your Site

when you are building a site from scratch, the best practice is to put all of the images the site uses inside a folder .

2. Adding Images

3. Changing the sizeof Images

example:

<img src="images/quokka.jpg" alt="A family of quokka" width="600" height="450" />

4. Where to Place Images in Your Code

Example:

1. <img src="images/bird.gif" alt="Bird" width="100" height="100" />

<p>There are around 10,000 living species of birds that inhabit different ecosystems from the Arctic to the Antarctic. Many species undertake long distance annual migrations, and many more perform shorter irregular journeys.</p>

2. <hr />

<p><img src="images/bird.gif" alt="Bird" width="100" height="100" /> There are around 10,000 living species of birds that inhabit different ecosystems from the Arctic to the Antarctic. Many species undertake long distance annual migrations, and many more perform shorter irregular journeys.</p> <hr />

3. <p>There are around 10,000 living species of birds that inhabit different ecosystems from the Arctic to the Antarctic.<img src="images/bird.gif" alt="Bird" width="100" height="100" /> Many species undertake long distance annual migrations, and many more perform shorter irregular journeys.</p>


<There is three rules for creating images>

  1. Save images in the right format (jpeg, gif, or png).
  2. Save images at the right size .
  3. Use the correct resolution.

5. Tools to Edit & Save Images

- About Images

6. Figure and Figure Caption

You can have more than one image inside the <figure> element as long as they all share the same caption.

Example:

<figure>

<img src="images/otters.jpg" alt="Photograph of two sea otters floating in water">

<br />

<figcaption>Sea otters hold hands when they sleep so they don't drift away from each other.</figcaption>

</figure>

<An overall about images>


Chapter 11: “Color”

Adding the colors in CSS

1. Color : it’s specify the color of text inside an element, and its defined by three ways:

Example:

/* color name */

h1 {

color: DarkCyan;}

/* hex code */

h2 {

color: #ee3e80;}

/* rgb value */

p { color: rgb(100,100,90);}

2. Background-color : it’s sets the color of the background for that element.

Example:

body { background-color: rgb(200,200,200);}

h1 { background-color: DarkCyan;}


<Understanding Color>


RGB Values:Values for red, green, and blue are expressed as numbers between 0 and 255.

Hex Codes:Hex values represent values for red, green, and blue in hexadecimal code.

Color Names:Colors are represented by predefined names.However, they are very limited in number.

Contrast:When picking foreground and background colors, it is important to ensure that there is enough contrast for the text to be legible.

3.Color Opacity

Example:

p.one {

background-color: rgb(0,0,0);

opacity: 0.5;}

p.two {

background-color: rgb(0,0,0);

background-color: rgba(0,0,0,0.5);}

4. HSL Colors

1. Hue:it is the colloquial idea of color. In HSL colors, hue is often represented as a color circle where the angle represents the color, although it may also be shown as a slider with values from 0 to 360.

2. Saturation:it is the amount of gray in a color. Saturation is represented as a percentage.100% is full saturation and 0% is a shade of gray.

3. Lightness:it is the amount of white (lightness) or black (darkness) in a color. Lightness is represented as a percentage.0% lightness is black, 100% lightness is white, and 50% lightness is normal.Lightness is sometimes referred to as luminosity.


- Using HSL & HSLA:The value of the property starts with the letters hsl, followed by individual values inside parentheses for:

- hue :this is expressed as an angle (between 0 and 360 degrees).

- saturation :this is expressed as a percentage.

- lightness :this is expressed as a percentage with 0% being white, 50% being normal, and 100% being black.

Example:

body {

background-color: #C8C8C8;

background-color: hsl(0,0%,78%);}

p {

background-color: #ffffff;

background-color: hsla(0,100%,100%,0.5);}

<An overall about colors>


Chapter 12: “Text”

- Font wiegth:

Example:

.credits {

font-weight: bold;}


- Font style:

Example:

.credits {

font-style: italic;}


- Font stretch:


For specifying the typeface for your webpage by using the Font-family

Example:

body {

font-family: Georgia, Times, serif;}

h1, h2 {

font-family: Arial, Verdana, sans-serif;}

.credits {

font-family: "Courier New", Courier,monospace;}


For adjust the size of the type by using the font-size

Example:

body {

font-family: Arial, Verdana, sans-serif;

font-size: 12px;}

h1 {

font-size: 200%;}

h2 {

font-size: 1.3em;}


For using a font even if it is not installed on the computer of the person browsing,by using the @font-face

Example:

@font-face {

font-family: 'ChunkFiveRegular';

src: url('fonts/chunkfive.eot');}

h1, h2 {

font-family: ChunkFiveRegular, Georgia, serif;}


For changing the case of text to uppercase or lowercase orcapitalize, by using the text-transform

Example:

h1 {

text-transform: uppercase;}

h2 {

text-transform: lowercase;}

.credits {

text-transform: capitalize;}


To control the appearance of the font, bu using the text-decoration

Example:

.credits {

text-decoration: underline;}

a {

text-decoration: none;}


To adjust the text hiegth, by using the line-height

Example:

p {

line-height: 1.4em;}


To control the space between each letter with using the letter-spacing and to control the gap between words using the word-spacing .

Example:

h1, h2 {

text-transform: uppercase;

letter-spacing: 0.2em;}

.credits {

font-weight: bold;

word-spacing: 1em;}


To control the alignment of text,with using the text-align

Example:

h1 {

text-align: left;}

p {

text-align: justify;}

.credits {

text-align: right;}


For the vertical alignment , with use vertical-align

Example:

#six-months {

vertical-align: text-top;}

#one-year {

vertical-align: baseline;}

#two-years {

vertical-align: text-bottom;}


It is more commonly used with inline elements such as <img ,<em>, or <strong> elements. And used with table cells (the <td> and <th> elements).

To indent the first line of text within an element, with using the text-indent.It’s be specified in a number of ways but is usually given in pixels or ems.

Example:

h1 {

background-image: url("images/logo.gif");

background-repeat: no-repeat;

text-indent: -9999px;}

.credits {

text-indent: 20px;}


To create a drop shadow for a text , with using the text-shadow

Example:

p.one {

background-color: #eeeeee;

color: #666666;

text-shadow: 1px 1px 0px #000000;}

p.two {

background-color: #dddddd;

color: #666666;

text-shadow: 1px 1px 3px #666666;}

To specify different values for the first letter or first line of text inside an element using first-letter and first-line.

Example:

p.intro:first-letter {

font-size: 200%;}

p.intro:first-line {

font-weight: bold;}


Eaxmple:

a:link {

color: deeppink;

text-decoration: none;}

a:visited {

color: black;}

a:hover {

color: deeppink;

text-decoration: underline;}

a:active {

color: darkcyan;}


To change the appearance of elements when a user is interacting with them,by using hover, active, focus

Example:

input {

padding: 6px 12px 6px 12px;

border: 1px solid #665544;

color: #ffffff;}

input.submit:hover {

background-color: #665544;}

input.submit:active {

background-color: chocolate;}

input.text {

color: #cccccc;}

input.text:focus {

color: #665544;}

<An overall about text>

References:

@Jon Duckett/HTML & CSS