a logo, photograph, illustration, diagram, or chart.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
To add an image into the page using an <img> tag, It must carry be following with these two attributes:
- src : it is the URL for the image.
- alt : it is a text description of the image which describes the
image if it is not appearing in the web page.
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>
5. Tools to Edit & Save Images
- About Images
width and height that you want them to appear on the page.72 ppi. The higher the resolution of the image, the larger the size of the file.GIFs show several frames of animage in sequence and therefore can be used to create simple animations.Transparent GIF,PNG.6. Figure and Figure Caption
<figure> and the <figcaption> elements .<figure> element it is to contain images and their caption<figcaption> element it is used in order to allow web page authors to add a caption to an image.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>
<img> element is used to add images to a web page.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 forred, green, and blueare expressed as numbers between0 and 255.
Hex Codes:Hex values represent values forred, green, and blueinhexadecimal code.
Color Names:Colors are represented bypredefined 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
0.0 and 1.0 (so a value of 0.5 is 50% opacity and 0.15 is 15% opacity).Using :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>
RGB values, hex codes, and color names.RGB colors to indicate opacity. It is known asRGBA.HSL values, with an optional opacity value. It is known as HSLA.Wiegth (Light,Medium,Bold,Black).Example:
.credits {
font-weight: bold;}
Style (Normal,Italic,Oblique)Example:
.credits {
font-style: italic;}
Stretch (Condensed,Regular,Extended)Font-familyExample:
body {
font-family: Georgia, Times, serif;}
h1, h2 {
font-family: Arial, Verdana, sans-serif;}
.credits {
font-family: "Courier New", Courier,monospace;}
font-sizeUnits of Type Size: Pixels, Percentages, Ems.Example:
body {
font-family: Arial, Verdana, sans-serif;
font-size: 12px;}
h1 {
font-size: 200%;}
h2 {
font-size: 1.3em;}
@font-faceExample:
@font-face {
font-family: 'ChunkFiveRegular';
src: url('fonts/chunkfive.eot');}
h1, h2 {
font-family: ChunkFiveRegular, Georgia, serif;}
text-transformExample:
h1 {
text-transform: uppercase;}
h2 {
text-transform: lowercase;}
.credits {
text-transform: capitalize;}
text-decorationnone: this removes any decoration already applied to the text.underline: this adds a line underneath the text.overline: this adds a line over the top of the text.line-through: this adds a line through words.blink: this animates the text to make it flash on and offExample:
.credits {
text-decoration: underline;}
a {
text-decoration: none;}
line-heightExample:
p {
line-height: 1.4em;}
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;}
text-alignleft: this indicates that the text should be left-aligned.right: this indicates that the text should be right-aligned.center: this allows you to center text.justify: this indicates that every line in a paragraph, except the last line, should be set to take up the full width of the containing box.Example:
h1 {
text-align: left;}
p {
text-align: justify;}
.credits {
text-align: right;}
vertical-alignExample:
#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).
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;}
text-shadowExample:
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;}
first-letter and first-line.Example:
p.intro:first-letter {
font-size: 200%;}
p.intro:first-line {
font-weight: bold;}
link, visitedlink: this allows you to set styles for links that have not yet been
visited.visited: this allows you to set styles for links that have been clicked on.Eaxmple:
a:link {
color: deeppink;
text-decoration: none;}
a:visited {
color: black;}
a:hover {
color: deeppink;
text-decoration: underline;}
a:active {
color: darkcyan;}
hover, active, focushover: this is applied when a user hovers over an element with a pointing device such as a mouse.active: this is applied when an element is being activated by a user; for example, when a button is being pressed or a link being clicked.focus: this is applied when an element has focus. Any element that you can interact with.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