You are on page 1of 3

Ashwin Katkar D16 45

Experiment 3
Aim:
Design web pages using HTML5 and CSS3 on selected problem statements.
Design at least two pages linked with each other and containing links to other websites
on the Internet.

Software: HTML5, CSS

Theory:
Cascading Style Sheets (CSS) is a stylesheet language used to describe the
presentation of a document written in HTML. It describes how elements should be rendered on
screen, on paper, in speech, or on other media — for example, to alter the font, color, size, and
spacing of the content, split it into multiple columns, or add animations and other decorative
features. An HTML page can be styled in three ways as follows.
1. Inline CSS - Using the style attribute, we can apply styling to our HTML inside individual
HTML tags with inline styling. The inline style applies only to the tag to which it is
applied. Using inline styles is not considered best practice, because it results in a lot of
Repetition.
2. Internal CSS - It is a set of styles created as part of an HTML document. Internal CSS
defines CSS styles within an HTML document’s <style> tag inside the <head> section of
the HTML file. However, all the changes done by the internal CSS can be applied only to
a single web page.
3. External CSS - It is used to style multiple HTML pages with a single style sheet. External
CSS contains a separate CSS file with a .css extension. The CSS file contains style
properties added on selectors (For example class, id, heading, … etc.). Advantage can
be enhanced reusability across multiple HTML files.
CSS-selector - In CSS, selectors are used to target the HTML elements on our web pages that
we want to style. There are a wide variety of CSS selectors available, allowing for fine-grained
precision when selecting elements to style.
1. Element selector - Selects HTML elements that are required to be styled. In a selector
declaration, there is the name of the HTML element and the CSS properties which are to
be applied to that element and are written inside the brackets {}.
2. Class selector - Selects all elements which belong to a particular class attribute. The
period (.) character specifying the class name is used to select elements based on their
classes.
3. CSS ID selector - The “#” CSS id selector is used to set the style of the given id. The id
attribute is the unique identifier in an HTML document. The id selector is used with a
#Character. 4. Universal selector - This is used to select any and all types of elements in an
Ashwin Katkar D16 45

HTML page. The asterisk (*) is used to denote universal selectors. 5. Group selector - When
several selectors share the same declarations, they may be grouped into a comma-separated
list. CSS specificity - CSS Specificity of the selectors can be determined when more than one set
of CSS rules applies to the same element, the browser will have to decide which specific set will
be applied to the element. This set of rules that the browser follows is collectively called
Specificity. The order of specificity is : Inline > Internal > External. Image sprite - It is basically an
image which is a collection of different images put together to form a single image. The use of
image sprites is done for two main reasons: For faster page loading use only a single image. It
reduces the bandwidth used to load multiple images. This way less data is Consumed.

Conclusion:
CSS functionalities like selectors, specificity and Image sprites are implemented. Difference
between Inline, Internal and External styles is observed. Working of types of selectors for
selection of elements as per classes, IDs, etc. is studied.
Ashwin Katkar D16 45

You might also like