-
use <img> tag
-
use src attribute which is the path or link to an image ,
optional Attributes:
- alt : attribute tells what is the image about .
- title : You can also use the title attribute with the <img>element to provide additional information about the image.
Example:
<img src="img/teamAttack.jpg" alt="Attack On Titans" title="Attack On Titans"/>
The Result:
-
Save images in the right format
-
Save images at the right size
-
Use the correct resolution
- JPEG : Whenever you have many different colors in a picture
- GIF or PNG : when saving images with few colors or large areas of the same color.
The color property allows you to specify the color of text inside an element.
- rgb values : These express colors in terms of how much red, green and blue are used to make it up.
For example: rgb(209, 0, 0)
<p style="color:rgb(209, 0, 0)">Hello World</p>
Hello World
- hex codes : These are six-digit codes that represent the amount of red, green and blue in a color, preceded by a pound or hash # sign.
For example: #6495ED
<p style="color :#6495ED">Hello World</p>
Hello World
- color names : There are 147 predefined color names that are recognized by browsers.
For example: DeepPink.
<p style="color:DeepPink">Hello World</p>
Hello World
The CSS font properties define the font family, boldness, size, and the style of a text.
Difference Between Serif and Sans-serif Fonts:
The font-family CSS property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.
For Example:
font-family: Georgia, serif;
Hello World
- ### font-size The font-size CSS property sets the size of the font. Changing the font size also updates the sizes of the font size-relative units, such as em, ex, and so forth.For Example:
font-size: 1.2em;
Hello World
The @font-face CSS at-rule specifies a custom font with which to display text; the font can be loaded from either a remote server or a locally-installed font on the user's own computer.
For Example:
@font-face {
font-family: "Open Sans";
src: url("/fonts/OpenSans-Regular-webfont.woff2")
format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
}
The font-weight CSS property sets the weight (or boldness) of the font. The weights available depend on the font-family that is currently set.
For Example:
font-weight: bold;
Hello World
The font-style CSS property sets whether a font should be styled with a normal, italic, or oblique face from its font-family.
For Example:
font-style: italic;
Hello World
The text-transform CSS property specifies how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
For Example:
text-transform: capitalize;
Hello World
The text-decoration shorthand CSS property sets the appearance of decorative lines on text.
For Example:
text-decoration: underline dotted red;
Hello World
The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element.
For Example:
line-height: 32px;
Hello World
The letter-spacing CSS property sets the horizontal spacing behavior between text characters.
For Example:
letter-spacing: 1px;
Hello World
The word-spacing CSS property sets the length of space between words and between tags.
For Example:
word-spacing: 1rem;
Hello World
The text-align CSS property sets the horizontal alignment of a block element or table-cell box. This means it works like vertical-align but in the horizontal direction.
For Example:
text-align: left;
Hello World
The vertical-align CSS property sets vertical alignment of an inline, inline-block or table-cell box.
For Example:
vertical-align: top;
Hello World
The text-indent CSS property sets the length of empty space (indentation) that is put before lines of text in a block.
For Example:
text-indent: 30%;
Hello World
The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations.
For Example:
text-shadow: red 2px 5px;
Hello World
The ::first-letter CSS pseudo-element applies styles to the first letter of the first line of a block-level element, but only when not preceded by other content
For Example:
p::first-letter {
font-size: 130%;
}
The ::first-line CSS pseudo-element applies styles to the first line of a block-level element.
For Example:
p::first-line {
color: red;
}