Untold Coding
Untold Coding
( HTML, CSS, JS )
HTML ( HyperText Markup Language)
1. How do you add comments in HTML?
To insert a comment in HTML you can simply use the lesser than sign at the
beginning and the greater than sign at the end like this: “<!- comment ->”.
2. Can you compare and contrast physical tags from logical tags?
Physical tags format and display the content inserted within the tags. They add
style defined by the parameters while logical tags define the meaning or structure
of the content within the tags.
Local storage - It keeps data safe, whenever someone exits the browser, the data
doesn't get deleted.
Session storage - Keeps the data only when someone is using the browser. As soon
as the browser closes, the data is immediately erased.
Ordered lists - This type of list displays elements that are in numerical order or
format. is the tag used to define this kind of list.
Unordered lists - This kind of list display elements in bulleted form. is the tag used
to define this kind of list.
Definition list - This is a kind of list that displays elements in dictionary form. The
tag is used to define definition lists.
<head>
<title>Page title</title>
</head>
<body>Body of contents</body>
</html>```
19.What is a marquee?
Marquee is used for scrolling text on a web page. By using the tag, one can scroll
either left, right, down, or up automatically.
20.What is a style sheet?
A style sheet helps in defining HTML templates. The templates can be linked to
multiple pages, making it easy to maintain and update the website look.
22.What are the types of headings you can use for your HTML doc?
There are about 5 types of headings that can be used. They can be defined by the
following tags:
Inline CSS - This is used for styling small contents. It is mainly used for styling
attributes inside the HTML elements in the body section.
Internal CSS - This is used for adding tags in the section of the document. It is
mainly for styling a single page that has a unique style.
External CSS - This is used when applying to multiple pages.
26.What is the default size for the text field?
The default size for a text field is about 20 characters long. But if you include the
size attribute one can set the size value to be as low as 1 and as high as the width of
the browser width.
1) What is CSS?
CSS stands for Cascading Style Sheet. It is a popular styling language which is used
with HTML to design websites. It can also be used with any XML documents
including plain XML, SVG, and XUL.
o CSS1
o CSS2
o CSS2.1
o CSS3
o CSS4
o Bandwidth
o Site-wide consistency
o Page reformatting
o Accessibility
o Content separated from presentation
o Bootstrap
o Foundation
o Semantic UI
o Gumby
o Ulkit
8) Why background and color are the separate properties if they
should always be set together?
There are two reasons behind this:
1. <style>
2. body {
3. background-color: linen;
4. }
5. h1 {
6. color: red;
7. margin-left: 80px;
8. }
9. </style>
10.
o You can create classes for use on multiple tag types in the document.
o You can use selector and grouping methods to apply styles in complex
situations.
o No extra download is required to import the information.
11) What is a CSS selector?
It is a string that identifies the elements to which a particular declaration apply. It is
also referred as a link between the HTML document and the style sheet. It is
equivalent of HTML elements. There are several different types of selectors in CSS:
-
o Selector
o Property
o Value
1. <style>
2. img.trans {
3. opacity: 0.4;
4. filter: alpha(opacity=40); /* For IE8 and earlier */
5. }
6. </style>
1. <style>
2. *{
3. color: green;
4. font-size: 20px;
5. }
6. </style>
7.
15) Which command is used for the selection of all the elements of a
paragraph?
The p[lang] command is used for selecting all the elements of a paragraph.
1. <style>
2. h2,p{
3. background-color: #b0d4de;
4. }
5. </style>
6.
18) Name the property for controlling the image repetition of the
background.
The background-repeat property repeats the background image horizontally and
vertically. Some images are repeated only horizontally or vertically.
1. <style>
2. body {
3. background-image: url("paper1.gif");
4. margin-left:100px;
5. }
6. </style>
7.
19) Name the property for controlling the image position in the
background.
The background-position property is used to define the initial position of the
background image. By default, the background image is placed on the top-left of the
webpage.
1. center
2. top
3. bottom
4. left
5. right
1. background: white url('good-morning.jpg');
2. background-repeat: no-repeat;
3. background-attachment: fixed;
4. background-position: center;
20) Name the property for controlling the image scroll in the
background.
The background-attachment property is used to specify if the background image is
fixed or scroll with the rest of the page in the browser window. If you set fixed the
background image, then the image not move during scrolling in the browser. Let's
take an example with the fixed background image.
1. <style>
2. .center {
3. text-align: center;
4. color: blue;
5. }
6. </style>
7.
CSS Id Selector
1. <style>
2. #para1 {
3. text-align: center;
4. color: blue;
5. }
6. </style>
7.
Syntax
Embedded: Embedded style sheets are put between the <head>...</head> tags.
Syntax
1. <style>
2. body {
3. background-color: linen;
4. }
5. h1 {
6. color: red;
7. margin-left: 80px;
8. }
9. </style>
External: This is used to apply the style to all the pages within your website by
changing just one style sheet.
Syntax
1. <head>
2. <link rel="stylesheet" type="text/css" href="mystyle.css">
3. </head>
27) What is the difference between logical tags and physical tags?
o Physical tags are referred to as presentational markup while logical tags are
useless for appearances.
o Physical tags are newer versions, on the other hand, logical tags are old and
concentrate on content.
28) What is the CSS Box model and what are its elements?
The CSS box model is used to define the design and layout of elements of CSS.
To understand its purpose and origin, let's take a look at its print display. In the
print display, an image is set into the page such that text wraps around it as needed.
The closest option is to use the 'initial' property value, which restores the default
CSS values, rather than the browser's default styles.
An element with a higher z-index is always stacked above than a lower index.
Z-Index can take the following values:
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <style>
5. h1.vis {
6. visibility: visible;
7. }
8.
9. h1.hid {
10. visibility: hidden;
11.}
12.</style>
13.</head>
14.<body>
15.<h1 class="vis">It is visible</h1>
16.<h1 class="hid">It is hidden</h1>
17.
18.<p>Note - Second heading is hidden, but it still occupy space.</p>
19.</body>
20.</html>
21.
display: none also hides the element but not occupy space. It will not affect the
layout of the document.
1. <!DOCTYPE html>
2. <html>
3. <head>
4. <style>
5. h1.vis {
6. display: block;
7. }
8.
9. h1.hid {
10. display: none;
11. }
12. </style>
13. </head>
14. <body>
15. <h1 class="vis">It is visible</h1>
16. <h1 class="hid">It is hidden</h1>
17.
18. <p>Note - Second heading is hidden and not occupy space.</p>
19. </body>
20. </html>
JavaScript
1. What are the differences between Java and JavaScript?
JavaScript is a client-side scripting language and Java is object Oriented
Programming language. Both of them are totally different from each other.
• Primitive
• Numbers
• Strings
• Boolean
• Symbol
• Trivial
• Undefined
• Null
• Composite
• Objects
• Functions
• Arrays
3. Which symbol is used for comments in JavaScript?
Comments prevent the execution of statements. Comments are ignored while the
compiler executes the code. There are two type of symbols to represent comments
in JavaScript:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<button onclick="create()">
Click Here!
</button>
<script>
function create() {
let untoldcoding = document.createElement('untoldcoding ');
untoldcoding .textContent = "Untoldcoding foruntoldcoding ";
untoldcoding .setAttribute('class', 'note');
document.body.appendChild(untoldcoding );
}
</script>
</body>
</html>
12. What are global variables? How are these variables declared,
and what are the problems associated with them?
In contrast, global variables are the variables that define outside of functions.
These variables have a global scope, so they can be used by any function without
passing them to the function as parameters.
Example:
function myFunction() {
document.getElementById("untoldcoding ").innerHTML
= typeof petName + "- " +
"My pet name is " + petName;
}
document.getElementById("untoldcoding ")
.innerHTML = typeof petName + "- " +
"My pet name is " + petName;
It is difficult to debug and test the code that relies on global variables.
document.getElementById("myText").style.fontSize = "16px;
document.getElementById("myText").className = "class";
untoldcoding = 42;
untoldcoding = " untoldcodingisbest ";
• Alert
• Confirm
• Prompt
28. What is the difference between an alert box and a confirmation
box?
An alert box will display only one button which is the OK button. It is used to
inform the user about the agreement has to agree. But a Confirmation box displays
two buttons OK and cancel, where the user can decide to agree or not.