Assigment 1 WT
Assigment 1 WT
Theory:
HTML-
The Hyper Text Markup Language or HTML is the standard markup language for
documents designed to be displayed in a web browser.
It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting
languages such as JavaScript.
Web browsers receive HTML documents from a web server or from local storage
and render the documents into multimedia web pages. HTML describes the structure of
a web page semantically and originally included cues for the appearance of the document.
HTML elements are the building blocks of HTML pages.
With HTML constructs, images and other objects such as interactive forms may be
embedded into the rendered page.
HTML provides a means to create structured documents by denoting
structural semantics for text such as headings, paragraphs, lists, links, quotes and other
items. HTML elements are delineated by tags, written using angle brackets.
Tags such as <img /> and <input /> directly introduce content into the page. Other tags
such as <p> surround and provide information about document text and may include
other tags as sub-elements.
Browsers do not display the HTML tags but use them to interpret the content of the page.
HTML was first created by Tim Berners-Lee, Robert Cailliau, and others starting
in 1989. It stands for Hyper Text Markup Language.
Hypertext means that the document contains links that allow the reader to jump to
other places in the document or to another document altogether. The latest version is
known as HTML5.
A Markup Language is a way that computers speak to each other to control how text is
processed and presented. To do this HTML uses two things: tags and attributes.
CSS-
CSS is used to control the style of a web document in a simple and easy way.
CSS is the acronym for "Cascading Style Sheet".
Why to Learn CSS?
Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended
to simplify the process of making web pages presentable.
CSS is a MUST for students and working professionals to become a great Software
Engineer specially when they are working in Web Development Domain. I will list down
some of the key advantages of learning CSS:
Create Stunning Web site - CSS handles the look and feel part of a web
page. Using CSS, you can control the color of the text, the style of fonts,
the spacing between paragraphs, how columns are sized and laid out, what
background images or colors are used, layout designs,variations in display
for different devices and screen sizes as well as a variety of other effects.
Become a web designer - If you want to start a carrer as a professional
web designer, HTML and CSS designing is a must skill.
Control web - CSS is easy to learn and understand but it provides
powerful control over the presentation of an HTML document. Most
commonly, CSS is combined with the markup languages HTML or
XHTML.
Learn other languages - Once you understands the basic of HTML and
CSS then other related technologies like javascript, php, or angular are
become easier to understand.
Applications of CSS-
As mentioned before, CSS is one of the most widely used style language over the web.
I'm going to list few of them here:
CSS saves time - You 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 you 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 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.
Code:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Javascript Quiz</title>
<link rel="stylesheet" href="style1.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-
awesome.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-
alpha.6/css/bootstrap.min.css">
</head>
<body>
<header class="header bg-primary">
<div class="left-title">JS Quiz</div>
<div class="right-title">Total Questions: <span
id="tque"></span></div>
<div class="clearfix"></div>
</header>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div id="result" class="quiz-body">
<form name="quizForm" onSubmit="">
<fieldset class="form-group">
<h4><span id="qid">1.</span> <span id="question"></span></h4>
<div class="option-block-container" id="question-options">
</div> <!-- End of option block -->
</fieldset>
<button name="previous" id="previous" class="btn btn-
success">Previous</button>
<button name="next" id="next" class="btn btn-
success">Next</button>
</form>
</div>
</div> <!-- End of col-sm-12 -->
</div> <!-- End of row -->
</div> <!-- ENd of container fluid -->
</div> <!-- End of content -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></
script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-
bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<script src="app.js"></script>
</body>
</html>
CSS:
.content {
margin-top: 54px;
}
.header {
padding: 15px;
position: fixed;
top: 0;
width: 100%;
z-index: 9999;
}
.left-title {
width: 80px;
color: #fff;
font-size: 18px;
float: left;
}
.right-title {
width: 150px;
text-align: right;
float: right;
color: #fff;
}
.quiz-body {
margin-top: 15px;
padding-bottom: 50px;
}
.option-block-container {
margin-top: 20px;
max-width: 420px;
}
.option-block {
padding: 10px;
background: aliceblue;
border: 1px solid #84c5fe;
margin-bottom: 10px;
cursor: pointer;
}
.result-question {
font-weight: bold;
}
.c-wrong {
margin-left: 20px;
color: #ff0000;
}
.c-correct {
margin-left: 20px;
color: green;
}
.last-row {
border-bottom: 1px solid #ccc;
padding-bottom: 25px;
margin-bottom: 25px;
}
.res-header {
border-bottom: 1px solid #ccc;
margin-bottom: 15px;
padding-bottom: 15px;
}
Javascript:
Output: