Scripting Language
A scripting language is a type of programming language that is used to automate
tasks and run scripts, often to control another program or system. Unlike traditional
programming languages, which require compilation before execution, scripts are
typically interpreted at runtime. Scripting languages are often used for web
development, system administration, and automating repetitive tasks.
Examples of Scripting Languages:
1. JavaScript – Commonly used in web development to create interactive
elements on web pages.
2. Python – Used for web development, data analysis, automation, and more.
3. PHP – Server-side scripting language primarily used in web development.
4. Ruby – A dynamic scripting language, often used for web development.
5. Perl – Known for text processing and used in system administration.
CSS (Cascading Style Sheets)
CSS is a stylesheet language used to control the presentation (look and feel) of a
web page written in HTML. It allows developers to separate the content of a web
page (HTML) from its visual appearance. With CSS, you can style HTML
elements by changing properties such as colors, fonts, layout, and spacing.
CSS Key Features:
1. Selectors – Used to target specific HTML elements to apply styles.
2. Properties – Define what aspect of the element you want to change (e.g.,
color, font-size).
3. Values – The specific settings for the properties (e.g., color: red;).
How to Link HTML to CSS
To apply CSS to an HTML document, you can use three methods: inline styles,
internal styles, and external stylesheets.
1. Inline Styles: CSS written inside an HTML tag using the style attribute.
<p style="color: blue;">This is a blue paragraph.</p>
2. Internal Styles: CSS written inside the <style> tag within the <head>
section of the HTML document.
<html>
<head>
<style>
p{
color: blue;
}
</style>
</head>
<body>
<p>This is a blue paragraph.</p>
</body>
</html>
3. External Stylesheet: The recommended method where you create a separate
CSS file and link it to your HTML document using the <link> tag.
HTML (in the <head> section):
<link rel="stylesheet" href="styles.css">
Writing CSS (Cascading Style Sheets)
CSS is written using rulesets that define how HTML elements should be styled.
Each ruleset consists of a selector (which specifies the HTML element(s) to style)
and one or more declarations (which define the style properties to apply).
Basic Structure of a CSS Rule
selector {
property: value;
}
Selector: Targets the HTML element(s) you want to style (e.g., p for
paragraphs, h1 for headers, .class-name for a specific class).
Property: Specifies the aspect of the element to style (e.g., color, font-size).
Value: Defines the settings for the property (e.g., blue, 16px).
Steps to Write CSS:
1. Identify the HTML Elements to Style Use selectors to target the elements,
like tags (e.g., h1), classes (.class-name), or IDs (#id-name).
h1 {
color: blue; /* Property: color; Value: blue */
font-size: 24px; /* Property: font-size; Value: 24px */
}
/* This sets the text color of all paragraph elements to green */
p{
color: green;
}
.button {
background-color: blue;
color: white;
}
h1, h2, h3 {
color: darkblue;
}