Professional Documents
Culture Documents
WP CDT6 Summary
WP CDT6 Summary
U18OE403D–WEB PROGRAMMING
4CSE AY:2022-23
CDT6- LECTURE SUMMARY
Lecture Learning Outcomes (LLOs):After completion of this lecture, you should be able to…
LLO1
On topic 1
Knowledge on different types of CSSand ability to choose the right one while designing
web pages.
LLO2
On topic 2
Ability to create CSS having multiple styles and class
Inline CSS
The following example sets the text color of the <h1> element to blue, and the text color
of the <p> element to red:
Example
<h1 style="color:blue;">A Blue Heading</h1>
The following example sets the text color of ALL the <h1> elements (on that page) to
blue, and the text color of ALL the <p> elements to red. In addition, the page will be
displayed with a "powderblue" background color:
<!DOCTYPE html>
<html>
<head>
Prepared by: SHAIK MUNAWAR, Dept of CSE, KITSW Page 1 of 3
Department of CSE, KITSW
U18OE403D–WEB PROGRAMMING
4CSE AY:2022-23
CDT6- LECTURE SUMMARY
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
CSS syntax contains a selector, and a class is exactly that. It is needed to stylize HTML
elements – including changing colors, fonts, or the size of a text. If you want to use a
class, use a full stop (.) followed by the class name in a style block. Next, use a bracket
called a declaration block that contains the property to stylize the element, such as text
color or text size.Let’s take an example, here’s how it looks if you want to change the
text color to green:
<style>
.green-text {
color: #008000;
}
</style>
CSS Classes will help you stylize HTML elements quickly. Moreover, you can avoid
repeating the same code for each HTML element that uses the same styling. Hence, the
amount of CSS code to use is reduced – which makes it more readable and easier to
debug.
<style> – the style tag specifies the style information of an HTML element. You
can put multiple style tags within an HTML document.
.classname – it refers to the attributes that will be added to the element. For
instance, the class name is green-text and font-36 since the element will have a
green color, and 36 pixels sized fonts. Also, don’t forget to put a dot (.) before the
class name as it won’t work otherwise.
After creating the classes, you can apply them to HTML elements:
To define multiple classes, separate the class names with a space, e.g. <div class="city
main">. The element will be styled according to all the classes specified.
In the following example, the first <h2> element belongs to both the city class and also to
the main class, and will get the CSS styles from both of the classes:
Example
LLP1(on LLO1):Create a HTML form that uses Inline, Internal and External CSS.
LLP2(on LLO2): Design a HTML page with multiple styles using HTML class attribute