Using www.bbc.com website,
discuss how the below languages could be used in the site with 2 examples.
1.HTML
2.CSS
3.JavaScript
4.JSON
1). HTML code ensures the proper formatting of text and images for your Internet browser. Without HTML, a browser would not know how to display text as elements or load images or other elements. HTML also provides a basic structure of the page, upon which Cascading Style Sheets are overlaid to change its appearance.
Template of HTML page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Example page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<h1>This is a heading</h1>
<p>This is an <b>example</b> of a basic HTML page.</p>
</body>
</html>
For more information look here: https://developer.mozilla.org/ru/docs/Web/HTML
2). CSS (Cascading Style Sheets) allows you to create great-looking web pages, but how does it work under the hood? This article explains what CSS is, with a simple syntax example, and also covers some key terms about the language.
How to add CSS file in HTML?
<head>
<link rel="stylesheet" href="mystyle.css">
</head>
How the CSS code looks like?
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
3). JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive. Where HTML and CSS are languages that give structure and style to web pages, JavaScript gives web pages interactive elements that engage a user.
JS code looks like:
var rows = prompt("How many rows for your multiplication table?");
var cols = prompt("How many columns for your multiplication table?");
if(rows == "" || rows == null)
rows = 10;
if(cols== "" || cols== null)
cols = 10;
createTable(rows, cols);
function createTable(rows, cols)
{
var j=1;
var output = "<table border='1' width='500' cellspacing='0'cellpadding='5'>";
for(i=1;i<=rows;i++)
{
output = output + "<tr>";
while(j<=cols)
{
output = output + "<td>" + i*j + "</td>";
j = j+1;
}
output = output + "</tr>";
j = 1;
}
output = output + "</table>";
document.write(output);
}
For more information about JS look here: https://learn.javascript.ru/
4). JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. Squarespace uses JSON to store and organize site content created with the CMS.
Syntax of JSON:
"foo" : {
"bar" : "Hello",
"baz" : [ "quuz", "norf" ]
}
For more info about JSON: https://www.json.org/json-en.html
Comments
Leave a comment