Professional Documents
Culture Documents
Chapter4 5 2
Chapter4 5 2
Chapter4 5 2
Style attributes can be used to bring a change in the appearance of the concerned
element.Some of the commonly used attributes are color,text-align etc
Attributes
1.color:Specifies the text-color of an element
2.text-align: Web browsers, by default, align content to the left. CSS lets you justify
content or align it to the left, right, or center. You can change the way text is aligned using
the text-align CSS property.
3.font-size: To change the size of your text, you can use the CSS property font-size.It
is mentioned in percentage like 200%,300% etc.
font-size:150%
4. float Property
The float property enables us to make an element float to the left or right side of its
container.Its values are left and right.
CHAPTER 5
INSERTING IMAGES
Most HTML pages contain images. Images are used to grab the attention of the
user. Adding images to a page greatly improves the look and feel of a web page.
Image Element
The <img> element is used to add an image to the web page. You can add
images that are on your web server or from a different website.
Src Attribute
The src attribute tells the web browser the location of the image relative to the
web page. The src attribute is mandatory. To add an image, the src attribute
must be set to the location where the image can be found.
This example below includes code for displaying an image on a web page.
<html>
<head>
<title>Adding an Image</title>
</head>
<body>
</body>
</html>
Image Attributes
Alt Attribute
The alt attribute contains a description of the image in text form. Browsers
display the contents of this attribute when the image cannot be loaded (due to a
slow connection or an error loading the image).
<html>
<head>
<title>Lake and Mountains</title>
</head>
<body>
<img src="lake-and-mountains.jpg" alt="Lake and Mountains"
height="180" width="270">
</body>
</html>