Iwt Assignment
Iwt Assignment
1. Selectors: CSS3 introduced new and advanced selectors, such as attribute selectors,
structural pseudo-classes, and more, which allow for more precise targeting of HTML
elements.
2. Box Model: Improved control over the box model with properties like box-sizing,
which lets you specify how an element's width and height should be calculated.
3. Text Effects: CSS3 allows for the creation of attractive text effects using properties like
text-shadow, text-overflow, and word-wrap.
4. Gradients: You can create gradient backgrounds and text using the linear-gradient
and radial-gradient properties, eliminating the need for image-based gradients.
5. Transformations: CSS3 enables 2D and 3D transformations of elements with properties
like transform, rotate, scale, and perspective, making it possible to create
animations and interactive elements.
6. Transitions: With CSS3 transitions, you can smoothly animate property changes over
time, giving a more polished feel to your web elements.
7. Animations: CSS3 animations allow you to create complex animations using keyframes,
easing functions, and more, without the need for JavaScript or Flash.
8. Multiple Backgrounds: You can apply multiple background images to an element and
control their positioning and stacking order with properties like background-image and
background-size.
9. Media Queries: CSS3 introduced media queries, which enable responsive web design
by allowing styles to be applied based on the characteristics of the viewing device, such
as screen size and orientation.
10. Flexbox: The Flexbox layout model is a powerful feature of CSS3 that simplifies the
design of complex layouts and the alignment of elements within a container.
11. Grid Layout: CSS Grid Layout allows for the creation of grid-based layouts, offering
precise control over the placement and alignment of elements within a grid.
12. Custom Fonts: With CSS3's @font-face rule, you can use custom web fonts, providing
more flexibility in typography choices.
13. Border-radius: The border-radius property enables the creation of rounded corners
on elements, adding visual appeal to various design elements.
14. Opacity: CSS3 introduced the opacity property, allowing you to control the
transparency of elements without affecting their content.
15. Shadows: You can create drop shadows and box shadows using properties like box-
shadow and text-shadow to add depth and dimension to elements.
16. RGBA and HSLA: CSS3 supports color specifications in RGBA (red, green, blue, alpha)
and HSLA (hue, saturation, lightness, alpha) formats, providing transparency options for
colors.
17. Filters: You can apply various visual effects to elements using CSS3 filters, including
blur, grayscale, and more.
18. Calculation: The calc() function allows for mathematical calculations within CSS
property values, making it easier to create dynamic layouts.
These features, among others, have significantly improved the capabilities of CSS for
web design, enabling designers and developers to create more engaging and
responsive web experiences.
1. Defining a Class: To define a class in CSS, you use a period (.) followed by the class
name. For example:
.my-class {
/* CSS rules go here */
}
2. Applying a Class: To apply a class to an HTML element, you use the class attribute
within the HTML tag. For example:
<p class="my-class">This is a paragraph with a custom class.</p>
3. Styling with Classes: Within the class definition, you can specify various CSS properties
and values to style the elements with that class. For example:
. my-class {
font-size: 16px;
color: #333;
background-color: #f0f0f0;
padding: 10px;
}
4. Multiple Classes: You can apply multiple classes to a single HTML element by
separating them with a space. This allows you to combine styles from different
classes. For example:
<div class="class1 class2">This element has multiple classes.</div> > This element
has multiple classes. </div>
5. Cascading and Specificity: CSS follows a cascading order of specificity, meaning that if
there are conflicting styles, the more specific rule takes precedence. Classes are less
specific than IDs and inline styles, but more specific than element selectors.
6. Reusability: One of the main advantages of using classes is reusability. You can apply
the same class to multiple elements, making it easy to maintain a consistent design
throughout your website.
htmlCopy code
<!DOCTYPE html>
<html>
<head>
<style>
.my-class {
font-size: 18px;
color: blue;
}
</style>
</head>
<body>
<h1 class="my-class">This is a heading with the class 'my-class'.</h1>
<p class="my-class">This is a paragraph with the same class.</p>
</body>
</html>
In this example, both the heading and the paragraph share the same styling defined by
the "my-class" class in the CSS, illustrating how classes can be used for consistent styling
across multiple elements.
Cascading Style Sheets (CSS) is a stylesheet language used for describing the
presentation and formatting of a document written in HTML or XML. It allows web
developers to control the visual appearance of web pages. Here are some background
properties and concepts related to CSS:
1. Cascading: The "C" in CSS stands for "Cascading," which signifies the order of
importance and specificity in styling rules. CSS rules can be defined in multiple places,
such as inline styles, external stylesheets, and browser defaults. The cascade determines
which rule takes precedence when there are conflicting styles.
2. Selectors: Selectors are patterns used to select HTML elements to which you want to
apply CSS styles. Common selectors include element selectors (e.g., p, h1), class
selectors (e.g., .button), and ID selectors (e.g., #header).
3. Properties: CSS properties are the attributes you want to style, such as color, font-
size, margin, and background-color. Each property has a name and a value, which
determines how the element is displayed.
4. Values: Values are specific settings for CSS properties. For example, you can set the
color property to values like "red," "#00ff00" (a hexadecimal color), or "rgb(255, 0, 0)"
(an RGB color).
5. Declaration: A declaration consists of a CSS property and its corresponding value. It is
usually enclosed in curly braces and separated by a colon. For example:
font-size: 16px;
6. Selectors and Declarations in Rules: CSS rules are made up of selectors and
declarations. For instance
h1 {
color: blue;
}
}
7. External Stylesheets: External CSS files are separate documents with a .css extension.
They are linked to HTML documents using the <link> element in the document's
<head> section.
8. Inline Styles: Inline styles are CSS styles applied directly to an HTML element within its
style attribute. They have the highest specificity.
9. Internal Stylesheets: Internal styles are defined within the <style> element in the
HTML document's <head>. They apply to that specific HTML document only.
10. Selectors Specificity: Specificity refers to the order of importance of selectors. It
determines which style rules will be applied if there are conflicting rules. Inline styles
have the highest specificity, followed by IDs, classes, and element selectors.
11. Inheritance: Some CSS properties are inherited from parent elements to their child
elements. For example, if you set a font style on a parent element, it may affect the text
within its child elements.
12. Box Model: The box model is a fundamental concept in CSS, where each HTML element
is considered a box with content, padding, borders, and margins. You can style these
aspects to control the element's layout and appearance.
13. Responsive Design: CSS is often used to create responsive web designs that adapt to
different screen sizes and devices. Techniques like media queries allow you to apply
different styles based on the device's characteristics.
4) Functions
Functions in CSS, when mentioned in web development, are often referring to CSS
functions or expressions that allow for dynamic styling and customization of web
elements. Here's an explanation in English:
In CSS (Cascading Style Sheets), functions are special constructs that enable us to apply
dynamic styling to web elements. They are used to calculate values or manipulate
properties based on specific conditions, user interactions, or other factors. CSS functions
are like mathematical functions, taking one or more input parameters and returning a
computed value.
1. calc(): This function is used for performing arithmetic operations within CSS property
values. It allows you to combine different units, percentages, and values to create
dynamic styles.
width:
calc(50% - 20px);
2. var(): The var() function is used to define and apply custom CSS variables (or custom
properties). It allows you to set values in one place and use them throughout your
stylesheet, making it easier to maintain and update styles.
:root {
--main-color: #3498db;
}
.button {
background-color: var(--main-color);
}
3. min(), max(), clamp(): These functions are used to set responsive styles based on the
viewport size or other conditions. They help ensure that your design remains flexible
and adapts to different screen sizes.
font-size: min(2rem, 5vw);
Form validation in JavaScript and HTML is an essential aspect of web development to ensure
that user-submitted data is accurate and meets the required criteria. Below is an example of how
to perform basic form validation using HTML and JavaScript.
<!DOCTYPE html>
<html>
<head>
<title>Form Validation</title>
<script>
function validateForm() {
return false;
return false;
} else {
if (!email.match(emailPattern)) {
return false;
}
}
return false;
return false;
</script>
</head>
<body>
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="password">Password:</label>
</form>
</body>
</html>
2. What is DOM? What is its role in DHTML?
Levels of DOM:
Level 0: Provides a low-level set of interfaces.
Level 1: DOM level 1 can be described in two parts: CORE and HTML.
CORE provides low-level interfaces that can be used to represent
any structured document.
HTML provides high-level interfaces that can be used to represent
HTML documents.
Level 2: consists of six
specifications: CORE2, VIEWS, EVENTS, STYLE, TRAVERSAL,
and RANGE.
CORE2: extends the functionality of CORE specified by DOM level
1.
VIEWS: views allows programs to dynamically access and
manipulate the content of the document.
EVENTS: Events are scripts that are either executed by the
browser when the user reacts to the web page.
STYLE: allows programs to dynamically access and manipulate the
content of style sheets.
TRAVERSAL: This allows programs to dynamically traverse the
document.
RANGE: This allows programs to dynamically identify a range of
content in the document.
Level 3: consists of five different specifications: CORE3, LOAD and
SAVE, VALIDATION, EVENTS, and XPATH.
CORE3: extends the functionality of CORE specified by DOM level
2.
LOAD and SAVE: This allows the program to dynamically load the
content of the XML document into the DOM document and save the
DOM Document into an XML document by serialization.
VALIDATION: This allows the program to dynamically update the
content and structure of the document while ensuring the document
remains valid.
EVENTS: extends the functionality of Events specified by DOM
Level 2.
XPATH: XPATH is a path language that can be used to access the
DOM tree
1. Structured Representation: The DOM represents the elements and content of a web
page in a structured format, where each element is treated as an object, and they are
organized hierarchically. This structure allows web developers to access and manipulate
the content and structure of a web page using programming languages like JavaScript.
2. Dynamic Content Manipulation: With the DOM, developers can dynamically update,
add, or remove content from a web page without requiring a full page reload. This
enables the creation of interactive and responsive web applications. For example, you
can change the text or attributes of HTML elements, create new elements on the fly, or
remove elements from the document.
3. Event Handling: The DOM provides a mechanism for handling events like user
interactions (e.g., mouse clicks, keyboard input) or changes in the document (e.g.,
element load or change). This allows developers to define how the web page responds
to user actions and other events.
4. Cross-Browser Compatibility: The DOM standardizes the way web pages are accessed
and manipulated across different web browsers. This helps ensure that DHTML scripts
work consistently on various browsers, reducing compatibility issues.
3. How to use Email validation in Java Script? Like user in can’t enter invalid email
address. Write Java Script code.
You can use JavaScript to perform email validation by checking if a given email address
conforms to a valid email format. JavaScript doesn't provide built-in email validation, but
you can achieve this using regular expressions. Here's a simple example of how to do it:
function isValidEmail(email) {
// Regular expression for a basic email validation
var emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
return emailPattern.test(email);
}
var userEmail = "user@example.com"; // Replace this with the email you want to validate
if (isValidEmail(userEmail)) {
console.log("Valid email address");
} else {
console.log("Invalid email address");
}
You can adjust the regular expression to fit your specific email validation requirements.
This is a basic example, and email validation can be quite complex, but this should work
for most common cases.
Remember to replace "user@example.com" with the email address you want to validate.
The code will return true if the email is valid and false if it's not.
Element
Attributes
Entities
Elements
XML elements can be defined as building blocks of an XML
document. Elements can behave as a container to hold text,
elements, attributes, media objects or mix of all.
Example
<name>
Tutorials Point
</name>
Example
Entities
Entities are placeholders in XML. These can be declared in the
document prolog or in a DTD. Entities can be primarily categorized
as −
Built-in entities
Character entities
General entities
Parameter entities
There are five built-in entities that play in well-formed XML, they
are −
ampersand: &
Single quote: '
Greater than: >
Less than: <
Double quote: "
5. What is XML and attributes of XML?
1. Extensibility: XML is "extensible" because it allows users to define their own elements
and tags, making it adaptable to a wide range of applications. This extensibility is one of
its defining features, and it allows for the creation of custom data structures.
2. Hierarchy: XML data is organized in a hierarchical tree-like structure. It consists of
elements, which can contain other elements, creating a clear parent-child relationship.
This hierarchical structure is conducive to representing structured data.
3. Self-Descriptive: XML documents are self-descriptive, meaning they include
information about the data they contain. Each element is typically labeled with a start
tag and an end tag that specify its name. Additionally, attributes can be used to provide
metadata or additional information about elements.
4. Tags: XML uses tags to define elements. An element is enclosed within a pair of angle
brackets, such as <element>. The start tag opens the element, and the end tag closes it,
e.g., </element>. Elements can be nested within other elements.
5. Attributes: XML elements can have attributes associated with them. Attributes provide
additional information about the element. They are defined within the start tag of an
element and consist of a name and a value, separated by an equals sign. For example:
<book title="Introduction to XML" author="John Doe">
XML is widely used in various domains, including web services (SOAP and REST),
configuration files, data interchange, and more, due to its versatility and platform-
agnostic nature.
Cookies and sessions are essential components in web development, particularly when
working with PHP, to maintain and manage user data and state throughout a user's
interaction with a website or web application. Let's discuss both concepts and provide a
simple PHP program to demonstrate their usage.
Cookies: Cookies are small pieces of data stored on the user's browser. They are often
used to store user-specific information such as preferences or shopping cart contents.
Cookies are sent with every HTTP request, allowing the server to recognize the user and
provide a personalized experience.
Sessions: Sessions, on the other hand, are used to store user data on the server-side. A
unique session identifier is stored as a cookie on the user's browser, and the
corresponding data is stored on the server. This allows for secure storage of sensitive
information and user states
<?php
session_start();
Output:
If you refresh the page or navigate to a different page and run the script again,
it will show the following
Your favorite color is:blue
Your favorite color is: blue
<?php
// 86400 = 1 day
?>
Output:
The first time you run the script, it will show
Cookie is set
8. Write short note on radio buttons and check boxes object in Java Script.
Radio button: It is generally used in HTML forms. HTML forms are required
when you need to collect some data from the site visitors. A radio button is used
when you want to select only one option out of several available options.
Example:
<html>
<head>
<title>
Radio Button
<title>
</head>
<body>
<form>
<br>
<input type="radio"
name="agree"
value="yes">Yes
<br>
<input type="radio"
name="agree"
value="no">No
<br>
<input type="Submit">
</form> </body>
</html>
Checkbox: Checkboxes are also mostly used in HTML forms. A checkbox
allows you to choose one or many options to be selected from a list of
options.
Example:
<html>
<head>
<title>
HTML Checkbox
<title>
</head>
<body>
<form>
<br>
<input type="checkbox"
name="C"
value="yes">C
<br>
<input type="checkbox"
name="C++"
value="yes">C++
<br>
<input type="checkbox"
name="Java"
value="yes">Java
<br>
<input type="checkbox"
name="Python"
value="yes">Python
<br>
<input type="Submit">
</form>
</body>
</html>
phpMyAdmin:
1. Database Creation: Users can create new databases through the GUI.
2. Table Management: It allows users to create, modify, and delete database tables.
3. Data Entry and Editing: You can easily insert, update, and delete data in your database
tables.
4. SQL Query Execution: phpMyAdmin enables users to run SQL queries directly, making
it a valuable tool for database administrators and developers.
5. User Privilege Management: It helps in setting up user accounts and managing their
privileges, ensuring database security.
6. Import and Export Data: You can import data from various file formats (e.g., SQL, CSV)
and export data in different formats as well.
7. Server Status: Provides information about the server's health, performance, and
configuration.
8. Database Maintenance: It includes tools for optimizing, repairing, and analyzing
databases.
Database Bugs:
Database bugs refer to software defects or issues within a database management
system that can impact its functionality, data integrity, or security. These bugs can arise
from various sources, such as coding errors, software updates, hardware failures, or data
corruption. Here are some common types of database bugs:
1. Data Corruption: This bug occurs when data stored in the database becomes corrupt
due to various reasons, such as hardware failures, software errors, or incomplete
transactions. It can lead to data loss and incorrect query results.
2. Performance Issues: Performance-related bugs can cause slow query execution,
excessive resource usage, and bottlenecks in the database system. These issues may
result from inefficient query optimization, indexing problems, or hardware limitations.
3. Concurrency Problems: Concurrency bugs can lead to issues such as data inconsistency
when multiple users or applications access the database simultaneously. Problems like
deadlocks or race conditions can hinder proper data manipulation.
4. Security Vulnerabilities: Database bugs can also introduce security vulnerabilities.
These may allow unauthorized access, data leaks, or other malicious activities,
compromising the confidentiality and integrity of the data.
5. SQL Injection: SQL injection is a common type of bug where attackers exploit poorly
sanitized inputs to execute arbitrary SQL queries. This can lead to unauthorized data
access or modification.
6. Software Bugs: Bugs in the database management system's software can lead to issues
like crashes, incorrect results, or unexpected behavior. These bugs may arise from
coding errors, logic flaws, or software updates.
7. Data Loss: Data loss bugs can result in the accidental deletion or corruption of data due
to software or human errors. Regular backups are essential to mitigate the impact of
such bugs.
To address and prevent these database bugs, developers, administrators, and users
need to implement best practices for database management, perform thorough testing,
and keep their database management system and software up to date with the latest
patches and security measures. Regular monitoring and maintenance are also critical for
identifying and addressing potential issues before they lead to significant problems.
HTML (Hyper Text Markup Language) is used to create web pages and web
applications. It is a markup language. By HTML we can create our own static
page. It is used for displaying the data not to transport the data. HTML is the
combination of Hypertext and Markup language. Hypertext defines the link
between the web pages. A markup language is used to define the text
document within tag which defines the structure of web pages. This language is
used to annotate (make notes for the computer) text so that a machine can
understand it and manipulate text accordingly.
Example:
<!DOCTYPE html>
<html>
<head>
<title>GeeksforGeeks</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
</body>
</html>
XML: XML (eXtensible Markup Language) is also used to create web pages
and web applications. It is dynamic because it is used to transport the data not
for displaying the data. The design goals of XML focus on simplicity, generality,
and usability across the Internet. It is a textual data format with strong support
via Unicode for different human languages. Although the design of XML focuses
on documents, the language is widely used for the representation of arbitrary
data structures such as those used in web services.
Example:
html
<?xml version = "1.0"?>
<contactinfo>
<address category = "college">
<name>G4G</name>
<College>Geeksforgeeks</College>
<mobile>2345456767</mobile>
</address>
</contactinfo>
HTML XML
HTML stands for Hyper Text XML stands for Extensible Markup
2.
Markup Language. Language.
7. HTML can ignore small errors. XML does not allow errors.
1. Establish a Database Connection: First, you need to connect to your MySQL database.
Make sure to replace the placeholders with your actual database credentials.
<?php
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$database = "your_database";
// Create a connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
o connect to a MySQL database in PHP, you can use the mysqli extension. Here's a sample PHP
// Create a connection
$connection = mysqli_connect($servername, $username, $password, $database);
ceil() It returns a smallest integer value, greater than or equal to the given number.
floor() It returns largest integer value, lower than or equal to the given number.
What is a link?
It is a connection from one web resource to another. A link has two ends, An
anchor and direction. The link starts at the “source” anchor and points to the
“destination” anchor, which may be any Web resource such as an image, a
video clip, a sound bite, a program, an HTML document or an element within an
HTML document. You will find many websites or social media platforms ( Like
YouTube, and Instagram ) which link an image to a URL or a text to a URL etc.
This basically means that by using the ‘a’ tag, you can link 1 element of the
code to another element that may/may not be in your code.
HTML Link Syntax
Links are specified in HTML using the “a” tag.
<!DOCTYPE html>
<html>
<h3>Example Of Adding a link</h3>
<body>
<p>Click on the following link</p>
<a href="https://www.geeksforgeeks.org">GeeksforGeeks</a>
</body>
</html>
15.
1) Identifier in Java Script
JavaScript Identifiers are names given to variables, functions, etc. It is the same
as identifiers in other programming languages like C, C++, Java, etc. Let’s see
identifiers for variable names.
val
val1
result
While naming your variables in JavaScript, keep the following rules in mind.
You should not use any of the JavaScript reserved keywords as a variable name. These
keywords are mentioned in the next section. For example, break or boolean variable names
are not valid.
JavaScript variable names should not start with a numeral (0-9). They must begin with a
letter or an underscore character. For example, 5demo is an invalid variable name but
_5demo is a valid one.
JavaScript variable names are case-sensitive. For example, Name and name are two different
variables.
15
2)Keywords in Java Script
In JavaScript, keywords are reserved words that have special meanings and purposes
within the language. These words cannot be used as identifiers (variable names, function
names, etc.) because they are already used by the JavaScript language itself. Here are
some common keywords in JavaScript:
16. Write a PHP script which takes the user name, password and email values from user
and checks whether the user has filled the textboxes or not. Also, check the email field
whether it is incorrect format or not.
create a simple PHP script to take user input for a username, password, and email, and
then check whether the fields are filled and if the email is in the correct format. Here's a
basic example:
<!DOCTYPE html>
<html>
<head>
<title>Form Validation</title>
</head>
<body>
<?php
// Define variables to store user input and error messages
$username = $password = $email = "";
$usernameErr = $passwordErr = $emailErr = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Check if the username is filled
if (empty($_POST["username"])) {
$usernameErr = "Username is required";
} else {
$username = validateInput($_POST["username"]);
}
// Check if the password is filled
if (empty($_POST["password"])) {
$passwordErr = "Password is required";
} else {
$password = validateInput($_POST["password"]);
}
<h2>Form Validation</h2>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Username: <input type="text" name="username">
<span class="error"><?php echo $usernameErr; ?></span>
<br><br>
<?php
// If all fields are filled and email is in the correct format, you can process the data here
if (!empty($username) && !empty($password) && !empty($email) && empty($usernameErr)
&& empty($passwordErr) && empty($emailErr)) {
// Process the data, e.g., store it in a database or perform some action
echo "Username: " . $username . "<br>";
echo "Password: " . $password . "<br>";
echo "Email: " . $email . "<br>";
}
?>
</body>
</html>
The Array object lets you store multiple values in a single variable.
It stores a fixed-size sequential collection of elements of the same
type. An array is used to store a collection of data, but it is often
more useful to think of an array as a collection of variables of the
same type.
Syntax
Array Properties
Here is a list of the properties of the Array object along with their
description.
constructor
1
Returns a reference to the array function that created the object.
index
2
The property represents the zero-based index of the match in the string
input
3
This property is only present in arrays created by regular expression matches.
length
4
Reflects the number of elements in an array.
prototype
5
The prototype property allows you to add properties and methods to an objec
Array Methods
Here is a list of the methods of the Array object along with their
description.
concat()
1
Returns a new array comprised of this array joined with other array(s) and/or value(s).
every()
2
Returns true if every element in this array satisfies the provided testing function.
filter()
3 Creates a new array with all of the elements of this array for which the provided filtering
function returns true.
forEach()
4
Calls a function for each element in the array.
indexOf()
5 Returns the first (least) index of an element within the array equal to the specified value,
or -1 if none is found.
18. Write a Java Script which displays current date and time.
This tutorial teaches us to get the date and time in JavaScript. Nowadays,
JavaScript is the most popular programming language used for user interaction
with the browser. We can say that it is hard to find a single web application that
does not use JavaScript.
To solve all the problems, we just create an object of date class and use its various
methods to get the current date and time in this tutorial.
Syntax
<!DOCTYPE html>
<html>
<head>
<title>Display Current Date and Time</title>
</head>
<body>
<div id="datetime"></div>
<script>
// Function to update the date and time
function updateDateTime() {
var now = new Date();
var datetimeElement = document.getElementById("datetime");
datetimeElement.innerHTML = "Current Date and Time: " +
now.toLocaleString();
}