Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 3

CSS (Cascading Style Sheet)

Cascading Style Sheets (CSS) is a markup language responsible


for how your web pages will look like. It controls the colors,
fonts, and layouts of your website elements.
This style sheet language also allows you to add effects or
animations to your website. You can use it to display some CSS
animations like click button effects, spinners or loaders, and
animated backgrounds.
1)Inline :An inline CSS is used to apply a unique style to a
single HTML element.An inline CSS uses the style attribute of
an HTML element.
2)Internal: An internal CSS is used to define a style for a single
HTML page.An internal CSS is defined in the <head> section of
an HTML page, within a <style> element.
3)External: An external style sheet is used to define the style
for many HTML pages.To use an external style sheet, add a link
to it in the <head> section of each HTML page.

What is ID in HTML?
In HTML, the "id" selector is used id attribute of an element.
For an HTML element, the "id" name starts with the symbol '#'
followed by a unique name. One important characteristics of
the id element is that we can only attach one id selector to an
element. Hence, the ID selector is always unique within an
HTML page.
What is CLASS in HTML?
In HTML, the "class" selector is used to select an element with
a specific class attribute. The class selector starts with a period
(.) followed by a class name. Unlike the id selector, we can
attach multiple selector to an HTML element. Therefore, the
class can be applied many time within a page. The important
point to note about the class selector is that the class name
must not be started with a number.

Difference between ID and CLASS in HTML


Key Id(javascript) Class(css)
Syntax i) In HTML, for an element, the ID name
starts with the "#" symbol followed by a unique name
assigned to it.
i)"class" assigned to an element has its name starts with "."
followed by class name.
Selector
ii)Only one ID selector can be attached to an element.
ii)Multiple class selectors can be attached to an element.
Uniqueness
iii)ID is unique in a page and can only apply to at most one
element
iii)The class can be applied to multiple elements so it could be
multiple times on a single page.

You might also like