0% found this document useful (0 votes)
16 views12 pages

HTML and CSS Basics for Web Development

Uploaded by

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

HTML and CSS Basics for Web Development

Uploaded by

Mun Patel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

WebDevelopment(3151606) 220453116003

PART - A HTML

HTML is a markup language that defines the structure of your content. In the late 1980's , a
physicist, Tim Berners-Lee who was a contractor at CERN, proposed a system for CERN
researchers. In 1989, he wrote a memo proposing an internet based hypertext system. Tim Berners-
Lee is known as the father of HTML. The first available description of HTML was a document
called "HTML Tags" proposed by Tim in late 1991. The latest version of HTML is HTML5,

HTML consists of a series of elements, which you use to enclose, or wrap, different parts of the
content to make it appear a certain way, or act a certain way. The enclosing tags can make a word or
image hyperlink to somewhere else, can italicize words, can make the font bigger or smaller, and so
on.

Currently, there are 142 HTML tags available that allow for the creation of various elements.
Though modern browsers no longer support some of these tags. Just like any other computer
language, HTML has its strengths and limitations. Here are the pros and cons of HTML:

Pros:

 Beginner-friendly. HTML has a clean and consistent markup, as well as a shallow learning
curve.
 Support. The language is widely used, with a lot of resources and a large community behind
it.
 Accessible. It is open-source and completely free. HTML runs natively in all web browsers.
 Flexible. HTML is easily integrable with backend languages such as PHP and [Link].
Cons:

 Static. The language is primarily used for static web pages. For dynamic functionality, you
may need to use JavaScript or a back-end language such as PHP.
 Separate HTML page. Users have to create individual web pages for HTML, even if the
elements are the same.
 Browser compatibility. Some browsers adopt new features slowly. Sometimes older
browsers don’t always render newer tags.

Information Technology (SVMIT) 11


WebDevelopment(3151606) 220453116003

1. Design a HTML webpage containing resume of Mike as given below:

2. Design a HTML webpage which displays your class time table in tabular format
3. Design a HTML webpage containing the name of department in your institute and all
items of the link should have a link to webpage of respective departments.
4. Design a HTML webform as below:

Information Technology (SVMIT) 11


WebDevelopment(3151606) 220453116003

1. Design a HTML webpage containing resume of Mike as given below:

HTML Code:
<html>
<head>
<title> resume </title>
</head>
<body>
<h2><b><center><font color="blue">Mike Rosen</font></center></b></h2>
<h4><p><center>10255 Western Road, Washington DC 75165<br>972-555 8643</center></p></h4>
<dl>
<h3><dt>Objective</dt></h3>
<p><dd> A management position in a leading family restaurant chain.</dd></p>

<hr size="5" width="100%" color="black"><b><center></center></b></hr>

<h3><dt>Experience</dt></h3>
<p><dd>2002-present<br>
Senior Assistant Manager, Great Steaks Steakhouse. Duties include all operational tasks, personnel<br>
ordering and all local advertising and promotional events. Due to extensive local promotion and<br>
community involvement, our store's regional sales volume rank has increased from 11 to number 1 and<br>
profit margins have increased by 22%.</dd></p>

<p><dd>1999-2002<br>
Line cook and eventual crew chief at Pablo's Mexican restaurant.</dd></p>

<p><dd>1997-1999<br>
Mays department store, sales clerk.</dd></P>

Information Technology (SVMIT) 11


WebDevelopment(3151606) 220453116003

<hr size="5" width="100%" color="black"><b><center></center></b></hr>

<h3><dt>Education</dt></h3>
<p><dd>1997-2001<br>B.A. Business Administration and Food Service Management from Central Texas
University</dd></p>
<p><dd>1997<br>Valedictorian - West End high School</dd></p>

<hr size="5" width="100%" color="black"><b><center></center></b></hr>

<h3><dt>interest</dt></h3>
<p><dd>Big Brothers of Texas, white water rafting, personal computers, primitive camping, gourmet
cooking.</dd></p>
</dl>

</body>
</html>

Output:-

Information Technology (SVMIT) 11


WebDevelopment(3151606) 220453116003

PART – B CASCADING STYLE SHEETS (CSS)


CSS, or Cascading Style Sheets, is a language that is used in combination with HTML that
customizes how HTML elements will appear. CSS can define styles and change the layout and
design of a [Link] describes how elements should be rendered on screen, on paper, in speech,
or on other media.

CSS is among the core languages of the open web and is standardized across Web browsers
according to W3C specifications. Previously, the development of various parts of CSS
specification was done synchronously, which allowed the versioning of the latest
recommendations. You might have heard about CSS1, CSS2.1, or even CSS3. There will never be
a CSS3 or a CSS4; rather, everything is now CSS without a version number.

There are 3 ways to write CSS in our HTML file. Inline CSS, Internal CSS and External CSS
Priority order: Inline > Internal > External

Inline CSS
 Before CSS this was the only way to apply styles
 Not an efficient way to write as it has a lot of redundancy
 Self-contained
 Uniquely applied on each element
 The idea of separation of concerns was lost
Example:- <h3 style=” color:red”> Have a great day </h3>
<p style =” color: green”> I did this , I did that </p>

Internal CSS
 With the help of style tag, we can apply styles within the HTML file
 Redundancy is removed
 But the idea of separation of concerns still lost
 Uniquely applied on a single document
Example:- < style>
h1{
color:red;
}
</style>
External CSS

 With the help of <link> tag in the head tag, we can apply styles
 Reference is added
 File saved with .css extension
Information Technology (SVMIT) 11
WebDevelopment(3151606) 220453116003

 Redundancy is removed
 The idea of separation of concerns is maintained
 Uniquely applied to each document
Example: <head>
<link rel="stylesheet" type="text/css" href="name of the Css file">
</head>
h1{
color:red; //.css file
}

CSS Selectors are used to target elements and apply CSS.


Three simple selectors : Element Selector, Id Selector and Class Selector
Priority of Selectors: Id > Class>Element

Element Selector Id Selector Class Selector

Used to select HTML Used to target specific or Used to target a specific class
elements by its name unique element of the element
h1 #unique .group
{ { {
color: red; color: red; Color: red;
} } }
<h1 id=”unique”> Hi </h1> <h1 class=”group”>Hi </h1>
We selected the heading tag
and then changed the color We selected id and then We selected the class and then
property i.e text color to red. changed the color property i.e changed the color property i.e
Now whatever is written in text color to red. Now whatever text color to red. Now
this tag (content) will have is written in this tag (content) whatever is written in this tag
the text color as red will have the text color as red (content) will have the text
color as red

Advantages of CSS
 CSS saves time − One can write CSS once and then reuse same sheet in multiple HTML
pages. You can define a style for each HTML element and apply it to as many Web pages
as you want.
 Pages load faster − If we are using CSS, you do not need to write HTML tag attributes
every time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag.
So less code means faster download times.
 Easy maintenance − To make a global change, simply change the style, and all elements in
all the web pages will be updated automatically.
 Superior styles to HTML − CSS has a much wider array of attributes than HTML, so you
can give a far better look to your HTML page in comparison to HTML attributes.
 Multiple Device Compatibility − Style sheets allow content to be optimized for more than
one type of device. By using the same HTML document, different versions of a website
can be presented for handheld devices such as PDAs and cell phones or for printing.
 Global web standards − Now HTML attributes are being deprecated and it is being
Information Technology (SVMIT) 11
WebDevelopment(3151606) 220453116003

recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to
make them compatible to future browsers.

1. Create a webpage which displays "Welcome to Class of Web Development" with font size
50 pixels, italic format, in "Times New Roman" font and orange in colour using inline
CSS, embedded CSS and external CSS.

2. In a webpage that contains the class time table apply the CSS as per your choice.

3. Create the following page using HTML and CSS

OR

Information Technology (SVMIT) 11


WebDevelopment(3151606) 220453116003

4. Create a web page which displays a hyperlink for each subject in your current semester.
When the user clicks a link, it should open the respective subject's page. (Note: The
subject pages can be empty). Use CSS pseudo classes on hyper links.

1. Create a webpage which displays "Welcome to Class of Web Development" with font size
50 pixels, italic format, in "Times New Roman" font and orange in colour using inline
CSS, embedded CSS and external CSS.

HTML Code:

Output:-

Information Technology (SVMIT) 11


WebDevelopment(3151606) 220453116003

PART – C JAVASCRIPT (JS)

JavaScript, often abbreviated to JS, is a programming language that is one of the core technologies of
the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the
client side for webpage behavior, often incorporating third-party libraries.

It is a client side scripting language. It is basically used for validations. It was developed by Netscape
Communications. JavaScript is object based language not object oriented language. JavaScript is
embedded in the web pages and interpreted by the web browser.

Features of JavaScript:
 All popular web browsers support JavaScript as they provide built-in execution environments.
 JavaScript follows the syntax and structure of the C programming language. Thus, it is a
structured programming language.
 JavaScript is a weakly typed language, where certain types are implicitly cast (depending on the
operation).
 JavaScript is an object-oriented programming language that uses prototypes rather than using
classes for inheritance.
 It is a light-weighted and interpreted language.
 It is a case-sensitive language.
Information Technology (SVMIT) 11
WebDevelopment(3151606) 220453116003

 JavaScript is supportable in several operating systems including, Windows, macOS, etc.


 It provides good control to the users over the web browsers.

Application of JavaScript:
 Client-side validation,
 Dynamic drop-down menus,
 Displaying date and time,
 Displaying pop-up windows and dialog boxes (like an alert dialog box, confirm dialog box and
prompt dialog box),
 Displaying clocks etc.

Advantages:
The Web browser uses its own resources so less load on the server.

Disadvantages:
Code is usually visible
Local files and databases cannot be accessed as they are located on to the server.

JS frameworks are JavaScript programming libraries that have pre-written code to use for standard
programming functions and tasks. It’s a framework to create websites or web applications around.
there are over 20 JS frameworks that are well-known to the developer community, Some of popular
frameworks include ReactJS, Angular, [Link], jQuery, [Link] ,[Link], Meteor, Polymer

PART - D PHP

PHP is a general-purpose scripting language geared toward web development. It was originally
created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. It is very
simple to learn and use. The files have the extension “.php”.

Important points about PHP:


 PHP stands for Hypertext Preprocessor.
 PHP is an interpreted language, i.e., there is no need for compilation.
 PHP is faster than other scripting languages, for example, ASP and JSP.
 PHP is a server-side scripting language, which is used to manage the dynamic content of the
website.
 PHP can be embedded into HTML.
 PHP is an object-oriented language.
 PHP is an open-source scripting language.
 PHP is simple and easy to learn language.

Why PHP ???


Information Technology (SVMIT) 11
WebDevelopment(3151606) 220453116003

 It handles dynamic content, database as well as session tracking for the website.
 You can create sessions in PHP.
 It can access cookies variable and also set cookies.
 It helps to encrypt the data and apply validation.
 PHP supports several protocols such as HTTP, POP3, SNMP, LDAP, IMAP, and many
more.
 Using PHP language, you can control the user to access some pages of your website.
 As PHP is easy to install and set up, this is the main reason why PHP is the best language to
learn.
 PHP can handle the forms, such as - collect the data from users using forms, save it into the
database, and return useful information to the user. For example - Registration form.

Syntax:
<?php
// PHP code goes here
?>

A PHP framework is a platform to build PHP web applications. PHP frameworks provide libraries
for commonly used functions, which helps to cut down on the amount of original code developers
need to write from scratch. A PHP framework provides a basic foundation for the development of
web applications in PHP. Some of best PHP frameworks, based on their popularity and ability to
facilitate web application development – Laravel, Code Ignitor, CakePHP, Yii, Phalcon, Fat-Free,
etc.

PART - E PHP DATABASE CONNECTION

PHP is a server-side, HTML-embedded scripting language that may be used to create dynamic Web
pages. It is available for most operating systems and Web servers, and can access most common
databases, including MySQL. PHP may be run as a separate program or compiled as a module for
use with a Web server.

MySQL is a freely available open source Relational Database Management System (RDBMS) that
uses Structured Query Language (SQL). MySQL: Available for PHP versions 4 and 5, this
extension is intended for use with MySQL versions prior to MySQL 4.1. This extension does not
support the improved authentication protocol used in MySQL 4.1, nor does it support prepared
statements or multiple statements.

MySQLi: Stands for “MySQL, Improved”; this extension is available as of PHP 5.0.0. It is intended
for use with MySQL 4.1.1 and later. This extension fully supports the authentication protocol used
in MySQL 5.0, as well as the Prepared Statements and Multiple Statements APIs. In addition, this
Information Technology (SVMIT) 11
WebDevelopment(3151606) 220453116003

extension provides an advanced, object-oriented programming interface.

SQL is the most popular language for adding, accessing and managing content in a database. It is
most noted for its quick processing, proven reliability, ease and flexibility of use. MySQL is an
essential part of almost every open source PHP application. Good examples for PHP & MySQL-
based scripts are WordPress, Joomla! 3.x, and Drupal.

PHP and MySQL is built so that anyone with a minimum amount of programming knowledge can
put together a browser based web application. This easy entry to PHP development can also create
problems when an inexperienced programmer takes on a large Web Application project and does
not consider security implications, scalability and the SQL execution time when there are large
concurrent connections, just to start.

phpMyAdmin is an open-source software tool introduced on September 9, 1998, which is written in


PHP. Basically, it is a third-party tool to manage the tables and data inside the database.
phpMyAdmin supports various type of operations on MariaDB and MySQL. The main purpose of
phpMyAdmin is to handle the administration of MySQL over the web.

It is the most popular application for MySQL database management. We can create, update, drop,
alter, delete, import, and export MySQL database tables by using this software. phpMyAdmin also
supports a wide range of operation like managing databases, relations, tables, columns, indexes,
permissions, and users, etc., on MySQL and MariaDB. These operations can be performed via user
interface, while we still have the ability to execute any SQL statement.

phpMyAdmin is a GUI-based application which is used to manage MySQL database. We can


manually create database and table and execute the query on them. It provides a web-based interface
and can run on any server. Since it is web-based, so we can access it from any computer.

Information Technology (SVMIT) 11

Common questions

Powered by AI

Using a PHP framework in web development offers numerous benefits, primarily enhancing efficiency and security. Frameworks like Laravel, CodeIgniter, or Symfony provide pre-built modules and components, allowing developers to reduce redundant coding efforts by utilizing libraries that handle common functionalities such as authentication, session management, and database interactions. They promote clean and maintainable code by following the MVC (Model-View-Controller) architecture, which improves the organization of app logic and user interface layers. PHP frameworks also implement security mechanisms against common threats like SQL injection and cross-site scripting, fostering safer web applications. Additionally, frameworks are often accompanied by community support and documentation, which accelerates development speed and knowledge sharing. Overall, they streamline the development process, enabling developers to focus on unique application features rather than reinventing foundational code .

PHP and MySQL together play crucial roles in building dynamic websites by enabling server-side scripting and robust database management. PHP handles the business logic and user interface interaction, generating HTML dynamically and processing user inputs. MySQL serves as the back-end database, storing and retrieving the data needed to enrich the website's functionality. Their integration allows for real-time content updates, user authentication systems, and personalized user experiences based on database-stored preferences and interactions. However, challenges in using PHP and MySQL include ensuring secure connections to avoid SQL injection attacks, which necessitates thorough validation and escaping techniques. Scalability can be another concern; without proper query optimization and indexing, databases might suffer from performance degradation under heavy loads. Security issues like database exposure due to flawed configurations or lacking encryption can arise, necessitating strict measures to protect data integrity and privacy .

The history and evolution of HTML significantly influence modern web development practices by establishing a foundational structure for web content. HTML, first proposed by Tim Berners-Lee in 1989 and publicly detailed in 1991 with the "HTML Tags" document, introduced the concept of using hypertext to create interconnected web pages. This early framework has evolved substantially, with the latest version, HTML5, supporting more dynamic elements. HTML5 introduced semantic tags and embedded multimedia capabilities, which streamlined integration with other technologies like CSS for styling and JavaScript for interactive functionalities. The emphasis on accessibility, flexibility, and a large platform for integration set by the early principles of HTML continues to guide the creation and evolution of web standards, ensuring backward compatibility while embracing modern requirements. Thus, HTML's history underpins its enduring role as a core technology for web development .

Inline, internal, and external CSS differ primarily in how they apply styles and their impact on efficiency. Inline CSS is applied directly within an HTML element's style attribute, offering immediate effects but leading to redundancy and larger file sizes, making it inefficient for large projects. Internal CSS, defined within a style tag in the head section of the HTML document, allows styles to be applied consistently across that document but limits reusability across multiple documents, neglecting the principle of separation of concerns. External CSS, linked through a file with a .css extension, provides the most efficient method by enabling the same styles to be used across various HTML documents, promoting cleaner code and easier maintenance. This separation allows for global style changes by editing a single file, aligning with web standards and improving page load speed by reducing the need to repeatedly download styles .

PHP is a preferred language for web development concerning database interactions due to its seamless integration capabilities with various databases, particularly MySQL. PHP provides a straightforward syntax for embedding database queries within HTML code, which facilitates dynamic content generation. Its compatibility with MySQL/MariaDB, coupled with extensions like MySQLi and PDO, allows developers to perform traditional and prepared SQL statements efficiently, enhancing security against SQL injection attacks. PHP's ability to handle HTTP requests and sessions, alongside managing encrypted data transmission, makes it integral for applications requiring user authentication and personalized content delivery. Furthermore, PHP's open-source nature and vast community support provide extensive libraries and documentation, easing the implementation of complex database operations in an approachable manner. As a server-side language, PHP efficiently processes database interactions without exposing sensitive details to the client-side, offering a secure execution environment .

CSS enhances the styling and adaptability of web content compared to HTML by providing a more extensive and efficient approach to design. While HTML defines the structure and basic presentation, CSS enables detailed styling and layout control, allowing developers to separate content from presentation. CSS allows for precise color, font, and layout specifications that are not feasible with HTML alone. It supports responsive design, adapting content to multiple devices and screen sizes, which is crucial for modern web development. Additionally, CSS reduces redundancy by allowing a single stylesheet to style multiple HTML pages, simplifying maintenance and improving load times as styles don't need to be repeatedly defined inline. Through features like CSS selectors and pseudo-classes, developers can easily manage complex styling scenarios, making content more visually appealing and consistent across different platforms .

CSS frameworks are considered advantageous for front-end development because they provide a set of pre-designed components and standardized styles, significantly accelerating the development process and ensuring a consistent design language across projects. Frameworks like Bootstrap include responsive grid systems, predefined UI components, and cross-browser compatibility features, reducing the complexity of implementing these functionalities from scratch. They encourage clean, maintainable code with modular structures, which simplifies scaling and adapting styles to complex layouts or different devices. However, potential issues with using CSS frameworks include increased file sizes due to unused styles, which can affect load times if not appropriately managed, and a 'cookie-cutter' look that can arise if the styles are not customized. Over-reliance on frameworks might also hinder deeper CSS learning as developers may not explore underlying CSS techniques and concepts thoroughly .

The introduction of HTML5 has transformed web application capabilities by incorporating advanced features that address both multimedia handling and semantic content structuring. Unlike its predecessors, HTML5 provides native support for multimedia elements like audio and video, eliminating dependency on third-party plugins such as Flash, which enhances both performance and security. It introduced various semantic tags, ensuring better content organization and accessibility, which improves SEO and screen reader compatibility. HTML5's canvas element enables dynamic drawing and is foundational for complex client-side graphics and animations, previously only possible with external libraries or tools. Additionally, HTML5 facilitates local data storage through technologies like localStorage and sessionStorage. This capability allows web applications to store data in a user's browser, creating smoother experiences with offline capabilities. These transformations prompt a more interactive and immersive environment, redefining what web applications can accomplish .

JavaScript frameworks significantly enhance the development process in scenarios requiring complex, interactive web applications with high efficiency and scalability. Frameworks like Angular, React, and Vue offer robust structures for managing sophisticated UI states and data flows, promoting consistency through reusable components and efficient state management. They streamline development through tools for rapid prototyping, testing, and building, and enable handling of single-page applications' challenges, such as dynamic content updating and component-based architecture, which improves performance and user experience. However, possible drawbacks include a steep learning curve for developers unfamiliar with the ecosystem and a potential for large bundle sizes that could degrade performance if optimizations aren't applied. Additionally, updates in rapidly evolving frameworks may necessitate frequent refactoring, causing maintenance challenges. Vendors' opinionated architectures might also limit flexibility, binding applications to certain patterns that may not suit specific project needs .

JavaScript is considered a cornerstone technology for web development because it enables dynamic and interactive user experiences, which are crucial for modern web applications. As a client-side scripting language, JavaScript facilitates real-time interactions without the need for constant server requests, providing immediate feedback and improving performance and user engagement. It supports event-driven programming and allows for rich user interface elements such as dynamic menus, animations, and form validations directly in the browser. Despite being client-side, JavaScript's capability to integrate with back-end technologies via AJAX and other asynchronous technologies further empowers developers to create seamless single-page applications. It is also highly adaptable, supported by vast libraries and frameworks like React, Angular, Vue, etc., which expedite complex application development. Its ubiquity across all platforms ensures that nearly every user can experience these enhanced functionalities without additional installations .

You might also like