Search This Blog

Q16-Q20

Q16. What is the difference between Div. and Span in HTML?
Q17. In HTML DOM. What would be the root element?
Q18. What is the difference between HTTP 1.1 and HTTP 2.0?
Q19. What is the last stable version of Bootstrap? (2020) -  Bootstrap 4. 
Q20. Bootstrap 4 feature Flex? what are the advantages?
-----------------------------------------------------------------------------------------------------------------------
Q16. What is the difference between Div. and Span in HTML?

Answer:

Div is a block element while span is a inline element in html. Thus if you make display:block on span it will act like div.
-----------------------------------------------------------------------------------------------------------------------
Q17. In HTML DOM. What would be the root element?

Answer:

HTML
-----------------------------------------------------------------------------------------------------------------------
Q18. What is the difference between HTML 1.1 and HTML 2.0?

Answer:
HTTP/2 supports queries multiplexing, headers compression, priority and more intelligent packet streaming management. This results in reduced latency and accelerates content download on modern web pages.

Multiplexing: HTTP/1.1 loads resources one after the other, so if one resource cannot be loaded, it blocks all the other resources behind it. In contrast, HTTP/2 is able to use a single TCP connection to send multiple streams of data at once so that no one resource blocks any other resource. HTTP/2 does this by splitting data into binary-code messages and numbering these messages so that the client knows which stream each binary message belongs to

Header compression: Small files load more quickly than large ones. To speed up web performance, both HTTP/1.1 and HTTP/2 compress HTTP messages to make them smaller. However, HTTP/2 uses a more advanced compression method called HPACK that eliminates redundant information in HTTP header packets. This eliminates a few bytes from every HTTP packet. Given the volume of HTTP packets involved in loading even a single webpage, those bytes add up quickly, resulting in faster loading.

priority HTTP/2 offers a feature called weighted prioritization. This allows developers to decide which page resources will load first, every time. In HTTP/2, when a client makes a request for a webpage, the server sends several streams of data to the client at once, instead of sending one thing after another. This method of data delivery is known as multiplexing

-----------------------------------------------------------------------------------------------------------------------
Q19. What is the last stable version of Bootstrap? (2020)

Answer:
Bootstrap 4. 
-----------------------------------------------------------------------------------------------------------------------
Q20. Bootstrap 4 feature Flex? what are the advantages?

Answer:
Flexbox is one of the crucial features of the Bootstrap 4 framework, but it is unavailable with the Bootstrap 3 framework. This useful feature allows you to change the size of grid columns, manage the alignment of layouts, navigate components, and even change complex layout formation with ease.

On the other hand, Bootstrap 3 relied on floats to carry out the above-mentioned tasks. However, the innovative Flexible Box Layout makes it a lot simpler to create design flexible responsive layout structure even without using positioning or float.

In fact, designers and developers who use the Flexbox will be able to do the following tasks with the utmost ease.
  • Create equal width grid columns
  • Design cards with equal width and height
  • Develop utility classes to easily alter direction, scaling, alignment, display, and more.
  • Add auto margin for easy spacing
  • Create justified navigation and button groups


Q11-Q15

Q11. What is Session Storage?
Q12. Few new features of HTML 5?
Q13. Is Doctype in HTML5 a required attribute?
Q14. What are Media queries in CSS3?
Q15. What is Canvas in HTML 5?
-------------------------------------------------------------------------------------------------------------------------
Q11. What is Session Storage?

Answer:
The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the specific browser tab or closes the browser.

Example
<script type="text/javascript">
// Check if the sessionStorage object exists
if(sessionStorage){
    // Store data
    sessionStorage.setItem("last_name", "Parker");
    // Retrieve data
    alert("Hi, " + localStorage.getItem("first_name") + " " + sessionStorage.getItem("last_name"));
} else{
    alert("Sorry, your browser do not support session storage.");
}
</script>

https://www.tutorialrepublic.com/html-tutorial/html5-web-storage.php
-------------------------------------------------------------------------------------------------------------------------
Q12. Few new features of HTML 5?

Answer:

  1. local storage and session storage.
  2. Introduction new elements like Email, placeholders, progress, time etc
  3. Introduction of headers and footers.
  4. Introduction of required attribute.
  5. no need to have  adobe flash and silver light.
  6. Introduction of Canvas by which u can manage graphics at run time using javascript.


New doctype.

old doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

New doctype
<!DOCTYPE html>

https://code.tutsplus.com/tutorials/28-html5-features-tips-and-techniques-you-must-know--net-13520
-------------------------------------------------------------------------------------------------------------------------
Q13. Is Doctype in HTML5 a required attribute?

Answer:
Yes but even if we don't define doctype at top of our page. browser will put it automatically at top of page and will render with default mode Standard Mode.
-------------------------------------------------------------------------------------------------------------------------
Q14. What are Media queries in CSS3?

Answer:
The @media rule is used to define different style rules for different media types/devices.
-------------------------------------------------------------------------------------------------------------------------
Q15. What is Canvas in HTML 5?

Answer:
The HTML <canvas> element is used to draw graphics, on the fly, via JavaScript. The <canvas> element is only a container for graphics.
-------------------------------------------------------------------------------------------------------------------------

Q6-Q10

Q6. What are pseudo class in css?
Q7. What are pseudo elements in css?
Q8. What is Doctype in HTML5? What is the requirement of using it?
Q9. Can we have multiple headers and footers in our single html page?
Q10. What is Local Storage in HTML5?


----------------------------------------------------------------------------------------------------------------------
Q6. What are pseudo class in css?

Answer:
A pseudo-class is used to define a special state of an element.
For example, it can be used to:
  • Style an element when a user mouses over it
  • Style visited and unvisited links differently
  • Style an element when it gets focus
Syntax:

selector:pseudo-class {
  property:value;
}


Example:
/* unvisited link */
a:link {
  color: #FF0000;
}

/* visited link */
a:visited {
  color: #00FF00;
}

/* mouse over link */
a:hover {
  color: #FF00FF;
}

/* selected link */
a:active {
  color: #0000FF;
}


https://www.w3schools.com/css/css_pseudo_classes.asp
https://www.youtube.com/watch?v=gtY7VBru06Y

----------------------------------------------------------------------------------------------------------------------
Q7. What are pseudo elements in css?

Answer:
CSS pseudo-element is used to style specified parts of an element.
For example, it can be used to:
  • Style the first letter, or line, of an element
  • Insert content before, or after, the content of an element
  • Notice the double :: for pseudo elements and : for pseudo class. 
Syntax:
selector::pseudo-element {
  property:value;
}

example:
p::first-line {
  color: #ff0000;
  font-variant: small-caps;
}

Must check below link
https://www.w3schools.com/css/css_pseudo_elements.asp
https://www.youtube.com/watch?v=GwAuU45IwoM

----------------------------------------------------------------------------------------------------------------------
Q8. What is Doctype in HTML5? What is the requirement of using it?

Answer:
Declaration of the doctype is the very first thing in your HTML document even before the <html> tag.
Declaring Doctype tells the browser to use "standard" mode to render the document.

Also by looking at syntax of doctype declaration browser knows in which HTML version page is written.
----------------------------------------------------------------------------------------------------------------------
Q9. Can we have multiple headers and footers in our single html page?

Answer:


Yes, we can have multiple headers and footers. Each header, footer will connect to its nearest ancestor section. like declaring header just after "body" tag and then declaring header just after "table" tag.
----------------------------------------------------------------------------------------------------------------------
Q10. What is Local Storage in HTML5?

Answer:
It is a data stored in web browser locally. It is a 5MB storage. Before local storage cache were used. local storage stores data with no expiration date. The data will not be deleted when the browser is closed, and will be available the next day, week, or year..

data stored is in format of key/value pair.
localStorage.setItem(key, value): Stores a value associated with a key.
localStorage.getItem(key): Retrieves the value associated with the key.


Example
<script type="text/javascript">
// Check if the localStorage object exists
if(localStorage){
    // Store data
    localStorage.setItem("first_name", "Peter");
    // Retrieve data
    alert("Hi, " + localStorage.getItem("first_name"));
} else{
    alert("Sorry, your browser do not support local storage.");
}
</script>

https://www.tutorialrepublic.com/html-tutorial/html5-web-storage.php

----------------------------------------------------------------------------------------------------------------------

Q1-Q5

Q1. What is Box model?
Q2. What is specificity in CSS?
Q3. What is the difference between Static, Relative, Absolute and Fixed position in CSS?
Q4. Difference between visibility:hidden and display:none?
Q5. What is DOM?

--------------------------------------------------------------------------------------------------------------------------
Q1. What is Box Model?


Answer:

The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content



  • Content - The content of the box, where text and images appear
  • Padding - Clears an area around the content. The padding is transparent
  • Border - A border that goes around the padding and content
  • Margin - Clears an area outside the border. The margin is transparent
--------------------------------------------------------------------------------------------------------------------------
Q2. What is specificity in CSS?

Answer:
  • Specificity is the means by which browsers decide which CSS property values are the most relevant to an element and, therefore, will be applied. Specificity is based on the matching rules 
  • If there are two or more conflicting CSS rules that point to the same element, the browser follows some rules to determine which one is most specific and therefore wins out
https://www.w3schools.com/css/css_specificity.asp
--------------------------------------------------------------------------------------------------------------------------
Q3. What is the difference between Static, Relative, Absolute and Fixed position in CSS?

Answer:
There are 5 different positions values
  1. static
  2. relative
  3. fixed
  4. absolute 
  5. sticky
Above 5 positions are affected by 4 different properties. Above positions will not work unless we define the below properties.
  1. Top
  2. Bottom
  3. Left
  4. Right

position:static
  • HTML elements are positioned static by default.
  • Static positioned elements are not affected by the top, bottom, left, and right properties.
  • An element with position: static; is not positioned in any special way; it is always positioned according to the normal flow of the page:


position:relative

  • An element with position: relative; is positioned relative to its normal position.
  • Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. 
  • Other content will not be adjusted to fit into any gap left by the element.



position:fixed
  • An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.
  • A fixed element does not leave a gap in the page where it would normally have been located.


position:absolute
  • It is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed).
  • However; if an absolute positioned element has no positioned ancestors, it uses the document body, and moves along with page scrolling.


position:sticky
  • An element with position: sticky; is positioned based on the user's scroll position.
  • A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).

--------------------------------------------------------------------------------------------------------------------------
Q4. Difference between visibility:hidden and display:none?

Answer:
When display is none. element is not present and it does not hold the space on html. 
--------------------------------------------------------------------------------------------------------------------------
Q5. What is DOM?

Answer:
  • DOM- Document Object model. It is object oriented representation of webpage which can be modified using scripting languages like javascript. 
  • DOM Model represent a document with a logic tree. 
  • Every html tag is call object as per DOM Model. 
--------------------------------------------------------------------------------------------------------------------------