Web Programming with HTML, CSS, Bootstrap, JavaScript, React.JS, PHP, and MySQL Fourth Edition
()
About this ebook
Welcome to this beginner's guide tailored with college students in mind. Prior familiarity with concepts like file extensions, Web URLs, and major browsers is recommended. This comprehensive textbook serves as your gateway into the world of web programming, equipping you with foundational knowledge to embark on your coding journey.
Coverin
Related to Web Programming with HTML, CSS, Bootstrap, JavaScript, React.JS, PHP, and MySQL Fourth Edition
Related ebooks
How to Attack and Defend Your Website Rating: 0 out of 5 stars0 ratingsAprende programación python aplicaciones web: python, #2 Rating: 0 out of 5 stars0 ratingsASP.NET For Beginners: The Simple Guide to Learning ASP.NET Web Programming Fast! Rating: 0 out of 5 stars0 ratingsJavascript For Beginners: Your Guide For Learning Javascript Programming in 24 Hours Rating: 3 out of 5 stars3/5Mastering HTML and CSS for Modern Development Rating: 0 out of 5 stars0 ratingsJava / J2EE Interview Questions You'll Most Likely Be Asked Rating: 0 out of 5 stars0 ratingsFoundation Dynamic Web Pages with Python: Create Dynamic Web Pages with Django and Flask Rating: 0 out of 5 stars0 ratingsRust Servers, Services, and Apps Rating: 0 out of 5 stars0 ratingsjQuery 1.3 with PHP Rating: 0 out of 5 stars0 ratingsAJAX Interview Questions, Answers, and Explanations: AJAX Certification Review Rating: 0 out of 5 stars0 ratingsRESTful Java Web Services Interview Questions You'll Most Likely Be Asked: Second Edition Rating: 0 out of 5 stars0 ratingsHypertext Markup Language (HTML) Fundamentals: How to Master HTML with Ease Rating: 0 out of 5 stars0 ratings.Net Framework and Programming in ASP.NET Rating: 0 out of 5 stars0 ratingsLearning DHTMLX Suite UI Rating: 0 out of 5 stars0 ratingsLearn PHP Programming in 7Days: Ultimate PHP Crash Course For Beginners Rating: 3 out of 5 stars3/5Multi-Tier Application Programming with PHP: Practical Guide for Architects and Programmers Rating: 0 out of 5 stars0 ratingsWeb Services, Service-Oriented Architectures, and Cloud Computing: The Savvy Manager's Guide Rating: 0 out of 5 stars0 ratingsJames Learning Javascript Programming Rating: 0 out of 5 stars0 ratingsWeb Coding & Development All-in-One For Dummies Rating: 1 out of 5 stars1/5Reference to PHP, Second Edition Rating: 0 out of 5 stars0 ratingsCodeIgniter 1.7 Rating: 0 out of 5 stars0 ratings.NET Mastery: The .NET Interview Questions and Answers Rating: 0 out of 5 stars0 ratingsMastering ServiceStack Rating: 0 out of 5 stars0 ratingsHTML5,CSS3,Javascript and JQuery Mobile Programming: Beginning to End Cross-Platform App Design Rating: 5 out of 5 stars5/5HTML5 & CSS3 For Beginners: Your Guide To Easily Learn HTML5 & CSS3 Programming in 7 Days Rating: 4 out of 5 stars4/5Wb Development full course : from zero to web hero Rating: 0 out of 5 stars0 ratingsLearning ASP.NET Core MVC Programming Rating: 5 out of 5 stars5/5Practical Go: Building Scalable Network and Non-Network Applications Rating: 0 out of 5 stars0 ratingsProfessional Ajax Rating: 3 out of 5 stars3/5
Internet & Web For You
No Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsSocial Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Coding For Dummies Rating: 5 out of 5 stars5/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Six Figure Blogging Blueprint Rating: 5 out of 5 stars5/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5The Gothic Novel Collection Rating: 5 out of 5 stars5/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 4 out of 5 stars4/5200+ Ways to Protect Your Privacy: Simple Ways to Prevent Hacks and Protect Your Privacy--On and Offline Rating: 0 out of 5 stars0 ratingsPodcasting For Dummies Rating: 4 out of 5 stars4/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5Beginner's Guide To Starting An Etsy Print-On-Demand Shop Rating: 0 out of 5 stars0 ratingsMore Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5The Cyber Attack Survival Manual: Tools for Surviving Everything from Identity Theft to the Digital Apocalypse Rating: 0 out of 5 stars0 ratingsThe Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5The Internet Is Not What You Think It Is: A History, a Philosophy, a Warning Rating: 4 out of 5 stars4/5How To Start A Podcast Rating: 4 out of 5 stars4/5How to Destroy Surveillance Capitalism Rating: 4 out of 5 stars4/5Introduction to Internet Scams and Fraud: Credit Card Theft, Work-At-Home Scams and Lottery Scams Rating: 4 out of 5 stars4/5
Reviews for Web Programming with HTML, CSS, Bootstrap, JavaScript, React.JS, PHP, and MySQL Fourth Edition
0 ratings0 reviews
Book preview
Web Programming with HTML, CSS, Bootstrap, JavaScript, React.JS, PHP, and MySQL Fourth Edition - Larry Sanchez
Chapter 1: Introduction to the Web and HTML
Chapter Learning Outcomes:
1.1 Recognizing basic HTML tags
1.2 Summarizing how the World Wide Web works
1.3 Explaining HTML elements, tags, and attributes
1.4 Implementing HTML structure elements
1.5 Implementing HTML
1.1 The World Wide Web
The World Wide Web (abbreviated as 'the web' for the rest of the book) is an information system that allows users to utilize client software to request documents stored on server software through Uniform Resource Locators (URLs). Examples of client software include Firefox, Edge, Chrome, and Safari, while server software examples encompass Apache, IIS (Internet Information Server), and Nginx. An example of a URL is www.google.com. Users can type the URL of the server directly into the browser's address field or click on a hyperlink containing the URL. Requested documents can encompass files, images, songs, videos, and other resources.
Users can use the client software at any time to request information. The server software will either respond with the requested documents or a 404 Error (File not found Error). Thus, the server must always be on so that the client can access it at any time. Such an arrangement is often referred to as the client-server architecture.
Even with the client and server in place, you still cannot use the web without the Internet. The machines hosting the client and server must be connected to the Internet before any information exchange can occur. The Internet is a vast complex of computer networks that include server machines, desktops, and cell phones.
In this book, you will install the server and client on the same computer for the convenience of learning. In this case, you don't need the Internet because both the client and server software are on the same computer.
Review Question 1.1
The _______ is an information system that allows the users to use client software to request documents stored in a server through the Uniform Resource Locators.
A) web
B) computer
C) Internet
D) website
Review Question 1.2
Firefox, Internet Explorer/ Edge, Chrome, and Safari are examples of ___________.
A) server software
B) client software
C) Internet
D) website
Review Question 1.3
www.google.com is an example of ___________.
A) web
B) client software
C) Internet
D) URL.
Review Question 1.4
Apache, IIS (Internet Information Server), and Nginx are examples of ___________.
A) server software
B) client software
C) Internet
D) website
1.2 Web Programming
Computer programs are sets of instructions that computers follow. In the context of the web, these instructions are encapsulated within a Web Program, providing guidance for both client and server software. As a result, web programming encompasses the act of writing instructions for either the client, the server, or both. It serves as an umbrella term that covers various languages used for this purpose.
Throughout this book, we will explore several essential web programming languages, including HTML, CSS, JavaScript, PHP, and MySQL. Learning the syntax of these languages will empower you to command the client and server to collaborate effectively.
Specifically, this book will equip you with the skills to utilize HTML, CSS, and JavaScript to interact with client browsers and PHP and MySQL to work with server software. Through hands-on practice and guided examples, you will gain a comprehensive understanding of web programming, enabling you to create dynamic and interactive web applications..
Review Question 1.5
The ________ contains instructions for client and server software to follow.
A) web
B) web programming
C) Internet
D) website
Review Question 1.6
According to the author, which of the following is a server-side language?
A) HTML
B) CSS
C) PHP
D) Bootstrap
Review Question 1.7
According to the author, which of the following is a client-side language?
A) HTML
B) PHP
C) Laravel
D) MySQL.
1.3 HTTP (Hypertext Transfer Protocol)
In the realm of the web, browsers and web servers are often geographically distant from each other. To facilitate seamless communication between them, the Hypertext Transfer Protocol (HTTP) comes into play. HTTP consists of a set of standards or protocols that govern the exchange of requests and responses between the client and server. An analogy can be drawn to the guidelines you must follow when writing an address on an envelope for mailing – where to place your name and address and where to specify the recipient's name and address. A small error, like swapping the recipient's name and address, could lead to delays or non-delivery of the mail.
It is essential to recognize that HTTP communication is stateless, meaning that the server does not retain any memory of previous client requests. To address this limitation, cookies are utilized to maintain session information and track user interactions.
HTTP supports various types of requests, such as HTTP GET and HTTP POST, each serving distinct purposes. You will delve deeper into these concepts in a later chapter when you explore PHP. While detailed coverage of HTTP is usually found in telecommunication books, we mention it here to avoid any confusion between HTML and HTTP.
By understanding HTTP and its role in web communication, you will grasp the fundamental mechanics behind how information is exchanged between clients and servers, a crucial aspect of navigating the web effectively.
Review Question 1.8
HTTP communication is ________ which means a server does not keep track of the client requests.
A) trackless
B) stateless
C) serverless
D) free request
Review Question 1.9
Which of the following is NOT a type of HTTP request?
A) HTTP GET
B) HTTP POST
C) HTTP MAIL
D) All of the options are HTTP requests
Review Question 1.10
The __________ is a standard for the browsers and the Web servers to communicate with each other.
A) HTML
B) web programming
C) Internet
D) HTTP
1.4 HTML (Hypertext Markup Language)
HTML serves as a fundamental language used to create web pages, enabling the specification of content and structure. An HTML document is essentially a text file with a .xhtml file extension. While HTML itself is not intended for direct user consumption, web browsers interpret the HTML instructions, presenting the final product to users in the form of a web page.
The essence of HTML lies in its Markup
capability, which involves annotating a document with additional information. These annotations define various elements such as paragraphs, headings, and more. Angle brackets (<
and >
) are employed to differentiate these annotations, or tags,
from the regular text within the document.
Review Question 1.11
The HTML is a markup language that specifies _____ and _____ of a web page.
A) structure, format
B) content, format
C) content, markup
D) structure, content
Review Question 1.12
The major part of HTML is the Markup
. It means to ______ a document with extra information.
A) sum up
B) annotate
C) create
D) edit
Review Question 1.13
How does HTML distinguish annotations (tags) from regular text within a document?
A) By using square brackets [ ] around the annotations.
B) By using angle brackets < > around the annotations.
C) By using parentheses ( ) around the annotations.
D) By using curly brackets { } around the annotations.
Review Question 1.14
What role do web browsers play in relation to HTML documents?
A) Web browsers convert HTML documents into executable programs.
B) Web browsers interpret HTML instructions to create web pages for users.
C) Web browsers prevent HTML documents from being accessed by users.
D) Web browsers modify HTML documents to add security features.
Review Question 1.15
What is the primary purpose of HTML in web development?
A) To enable direct user interaction with web pages.
B) To specify content and structure of web pages.
C) To create web browsers that interpret HTML instructions.
D) To define complex algorithms for data processing.
1.5 Preparing for Coding
Before delving into HTML coding, it is essential to have a text editor to write your code. Any program source code is essentially a plain text file with varying file extensions. For this purpose, you can use simple text editors like Notepad for Windows or TextEdit for Mac.
However, in this book, we will utilize Visual Studio Code (VS Code), a powerful and free text editor built on open source technology, equipped with numerous extensions to enhance your coding experience. To get started, search for Visual Studio Code download
and visit the download website. Choose the appropriate version for your operating system (e.g., Windows user installer or system installer for sole users).
The installation process is straightforward, and you can generally accept all default settings. Once the program launches, you can close the Get Started
page.
Next, identify a folder where you will save your files. Click on File,
then select Open folder,
and choose a suitable location like your Desktop.
If you intend to manually write the code yourself, select Yes, I trusted the authors.
In the EXPLORER window, navigate to the DESKTOP
line and click on the New File icon. This action will create a new HTML file with a blank canvas to start coding.
Figure 1.1: Adding a new HTML file.
Feel free to give your new file any desired name and use the .xhtml file extension, which is standard for HTML files. With this setup, you are now all set and ready to begin your HTML coding journey.
Figure 1.2: A new blank HTML file called page1.xhtml
is created.
Review Question 1.16
An HTML file ______:
A) can only be created with a website editor
B) can be created with any text editor, such as Notepad
C) is basically a text file with HTML elements
D) can be created with any text editor and is basically a text file with HTML elements
Review Question 1.17
What is the primary purpose of a text editor in HTML coding?
A) To convert HTML code into executable programs.
B) To provide a platform for sharing HTML files with others.
C) To write and edit HTML code in plain text format.
D) To generate interactive visual representations of HTML code.
1.6 HTML Basic Structure
It is time for your first html file. Start a new HTML file named basicStructure.xhtml
and open it with your text editor. Type in the code as shown in Figure 1.3 HTML basic structure.
Figure 1.3 HTML basic structure
Explanation:
Line 1: Informs the browser that the following content is an HTML5 file. This line itself is not considered as an HTML element.
Lines 2 and 10: Define the opening and closing tags for the element. All other HTML elements should be placed between these lines. It is the largest container of an html file.
Lines 3 and 6: Define the opening and closing tags for the element. The element contains metadata for the webpage, such as character encoding, and is utilized by browsers, servers, and search engines.
Lines 4: The element, placed within the , specifies the document's character encoding for the browser to interpret the content correctly.
Line 5: It is the
Line 7 and 9: Define the opening and closing tags for the element. The element contains the information you want to display to the viewers of the webpage.
Line 8: Contains the
element, which indicates a paragraph in the web document. The content inside the
element will be visible to the viewers and is therefore a child element of .
The white circle next to the file name on VS Code indicates that the file has not been saved. To save the file, click on File,
then choose Save
or use the keyboard shortcut Ctrl+S (Windows).
To view the HTML file in a browser:
1. Go to the folder where you saved the HTML file.
2. Double-click on the HTML file to open it in a browser.
3. The browser will display the content according to the defined structure and metadata.
Review Question 1.18
Which of the following tags marks the beginning of an HTML file?
A)
B)
C)
D)
Review Question 1.19
The _____ element contains the metadata of the webpage file. Information inside this element is for browsers, servers, and search engines.
A)
B)
C)
D)
Review Question 1.20
What will the following HTML line of code do?
utf-8>
A) It defines the document’s character encoding.
B) It limits the number of characters in the document.
C) It inserts a line break every 8 lines of text in the document.
D) It makes the browser more secure.
Review Question 1.21
The _____ element will appear in the title bar of the browser (located at top left of a browser or at the status bar when the browser is minimized).
A)
B)
C)
D)
Review Question 1.22
The _____ element includes all information you want to show to the viewers of the web page.
A)
B)
C)
D)
Review Question 1.23
A paragraph in a web document is typically included in the _____ element.
A)
B)
C)
D)
1.7 The Importance of HTML Tags
In your basicstructure.xhtml file, if you remove the
and
tags and save the file, you may notice only a slight change, perhaps in the spacing above the line of text. At first glance, it might seem that there's no significant difference. However, HTML tags play a crucial role in providingmeta-informationto your webpage, which can have a significant impact on its appearance and behavior, even though the tags themselves are not visible in the final document.
While HTML tags do not directly appear in the finished document, they have essential functions that affect how your webpage looks and interacts with visitors. The primary purpose of HTML markup is to define the content and structure of the page, not its presentation. During coding, the focus should be on content and structure, determining whether a particular element is a paragraph or a heading, and its relative importance on the page. This understanding helps you choose the appropriate HTML element tags.
One key function of HTML markup is to provide accessibility features. Screen reader software for the visually impaired relies on HTML tags to read and interpret the webpage correctly. Additionally, HTML markup enhances search engine optimization, ensuring that your page is displayed accurately in search results.
HTML provides the fundamental structure and content for webpages. While technologies like Cascading Style Sheets (CSS, a topic you will learn about in Chapter 2) and JavaScript (a topic covered in Chapter 4) add styling and interactivity, they rely on the underlying HTML elements to function. For example, CSS rules target HTML tags and ids to style the page's appearance. Likewise, JavaScript code manipulates HTML elements to enable dynamic interactions. Without the semantic HTML markup, CSS and JavaScript would have no hooks to access and modify.
Review Question 1.24
Even though the HTML tags don’t show up in your finished document, they provide ______.
A) necessary browser supports
B) references to other documents
C) document update information
D) meta information of the document
Review Question 1.25
Which of the following is NOT the purpose of using HTML elements?
A) It allows screen reader software to read the page for the blind or visually impaired.
B) It helps the search engines display your page more accurately in the search result.
C) Cascading Style Sheet and JavaScript depends on it.
D) It speeds up the webpage downloading
Review Question 1.26
What is the main focus during HTML coding for webpages?
A) Styling and presentation of the webpage.
B) Determining