0% found this document useful (0 votes)
3 views2 pages

CSS JavaScript Exam Notes

The document provides an overview of CSS and JavaScript, highlighting their roles in web development. CSS is used for styling web pages, with methods for application including inline, document-level, and external styles, while JavaScript is a programming language for creating dynamic and interactive web content. Key concepts covered include CSS rules, the box model, JavaScript data types, functions, and the Document Object Model (DOM) for manipulating HTML and CSS.

Uploaded by

janani33306
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

CSS JavaScript Exam Notes

The document provides an overview of CSS and JavaScript, highlighting their roles in web development. CSS is used for styling web pages, with methods for application including inline, document-level, and external styles, while JavaScript is a programming language for creating dynamic and interactive web content. Key concepts covered include CSS rules, the box model, JavaScript data types, functions, and the Document Object Model (DOM) for manipulating HTML and CSS.

Uploaded by

janani33306
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSS and JavaScript - Exam Notes

CSS (Cascading Style Sheets)

CSS (Cascading Style Sheets) is a language used to describe the presentation of web pages written in HTML

or XHTML. It allows web developers to control the layout, style, and appearance of elements on a web page.

CSS is not part of HTML itself but is used to enhance and modify how HTML content is displayed in the

browser. CSS started with version 1 in 1996, evolved to CSS2 in 1998, and continues to develop with CSS3.

There are three main ways to apply CSS to a web page. Inline CSS applies styles directly within HTML tags

using the 'style' attribute, giving it the highest priority. Document-level CSS is placed within a <style> tag

inside the <head> section of the document, affecting the entire page. External CSS is written in separate .css

files and linked to multiple web pages, ensuring consistency across a website.

CSS rules consist of selectors and declarations. Selectors target HTML elements, and declarations define the

properties and values to be applied. These selectors can be simple, like using tag names, or more specific

like class selectors (using a dot prefix), id selectors (with a hash prefix), or pseudo-classes that respond to

user interactions like hovering.

Fonts and text in CSS can be customized extensively. Properties like font-size, font-family, and text-align

control appearance. Colors can be set using names, hexadecimal values, or RGB. The box model is a

fundamental concept in CSS, defining how margins, borders, padding, and content interact to determine an

element's final size and position.

CSS also allows styling lists, aligning text, and using background images. Additional tools like the <span>

and <div> tags allow developers to apply styles to specific inline or block-level sections of content. When

multiple style rules apply, CSS uses a cascade mechanism to resolve conflicts based on rule specificity and

origin.

JavaScript

JavaScript is a lightweight, interpreted programming language primarily used to create dynamic and
CSS and JavaScript - Exam Notes

interactive effects within web browsers. Initially developed by Netscape as LiveScript, it was standardized

under the name ECMAScript. JavaScript is widely supported by all modern browsers and plays a crucial role

in client-side scripting.

One of the most important aspects of JavaScript is that it is loosely typed and event-driven. This means that

variables do not require type declarations, and much of the code is designed to respond to user interactions,

such as clicks or keypresses. It is embedded in HTML documents, either within the <script> tag or by

referencing an external .js file.

JavaScript supports several core data types, including numbers, strings, booleans, undefined, and null. It

includes arithmetic and logical operators, and statements can include control structures like if-else,

switch-case, and loops such as for, while, and do-while. Functions in JavaScript are first-class objects,

meaning they can be assigned to variables, passed as parameters, or returned from other functions.

Objects in JavaScript are collections of properties and methods, and new objects can be created either using

constructor functions or object literals. Arrays are dynamic and can hold mixed data types. JavaScript also

includes built-in objects like Date, Math, and String, which provide various utility methods.

User input and output in JavaScript are handled through functions like alert, confirm, and prompt. The

Document Object Model (DOM) allows JavaScript to interact with HTML and CSS to manipulate the content

and style dynamically. Regular expressions offer powerful pattern matching capabilities for validating input or

searching text.

JavaScript plays a vital role in form validation, ensuring user input is correct before sending it to a server.

Despite its client-side nature, crucial validation must still be handled server-side, as client-side scripts can be

bypassed. Debugging JavaScript involves using browser tools and understanding common errors and their

causes.

You might also like