HTML Day-1


Q.1) What is the difference between div tag and span tag?

Ans:- HTML, div along with the span tag seems to be the same but, they are not. The div tag acts as a container for one or multiple elements, media types etc. and is a inline-block element to which we can assign any height and width. The span tag in HTML is a type of semantic tag, which means as the name "span" suggest this tag is used to span or put contenet, element anywhere in HTML document. Inspite this, the span tag is a Inline element due to which the height and width can't be assigned to this tag.


Q.2) What is the difference between class and ID's?

Ans:- In HTML, the both the class and ID's are used to identify the elements, such that to which class they belong to and what is their unique ID. This identification and classification helps us to target a specific element much more easily in CSS as well as in JavaScript. The specific difference between these two is that the samr class can be assigned to one or multiple elements, where as a ID is unique for each element and can not be replicated or given to multiple elements. Also there are different CSS selectors for the class and ID. To select an element with class we use "."
CSS class selector example:- .class-name{ CSS-property:value }
and to select an element with ID we use "#"
CSS ID selector example:- #ID-name{ CSS-property:value }


Q.3) What are self closing tags?

Ans:- In HTML, elements are defined by using tags i.e. to use heading elements we have 6 different heading tags ranging form h1 to h6 where h1 the largest heading and h6 being smallest heading. Every element has a opening tag and a closing tag to define a element.Self closing tags are also alternatively known as void tags, empty tags, singletons tags, etc. i.e these tags do not have contents and also can not have any child. Example of Heading element using h1 tag.

<h1>                 --> opening tag
    Hello World.
</h1>                --> closing tag

Some elements in HTML do not have a separate closing tags, so there is no need to close them by using a separate closing tags. Such elements are often reffered to as self-closing tags.
Example of self-closing tags are:- img, br, hr, input, link, meta etc.

<br>                --> no closing tags
<hr>                --> no closing tags
<img src="" alt=""> --> no closing tags
<meta>              --> no closing tags

Q.4) How many types of headings are there? How to decide which to use where?

Ans:- In HTML, Heading tags define the heading. HTML heading tags are important for both users and search engines. When users read a text, a good structure with paragraphs and headings help them orientate themselves. Paragraphs divide the text into smaller chunks, and headings clarify the structure of texts.there are total of 6 types of headings ranging from h1 to h6. h1 being the largest and boldest to, h6 being the smallest. The heading elements are as follows:- h1, h2, h3, h4, h5, h6.
While deciding where to use which heading following points might help:-
h1: It should be the main keyword of the landing page in the headline. In shops, for example, this could be the main category. In longer articles, the main keyword is usually the topic of the article.h2: The h2 headlines are well suited to secondary keywords or related keywords, or they can be used for longtail keywords or questions. h2 tags can also be used for optimizing for the Google Answer Box. h3 and h4: These headings should be used for less important topics. However, can also be used to add keywords to the main topic. h5 and h6:These are the smallest headings, mostly not used.


Q.5) What is the difference between inline and block level elements?

Ans:- Block elements: They consume the entire width available irrespective of their sufficiency. They always start in a new line and have top and bottom margins. It does not contain any other elements next to it.


Examples of Block elements:

<h1>-<h6>
    <div> 
    <hr>

Inline elements: Inline elements occupy only enough width that is sufficient to it and allows other elements next to it which are inline. Inline elements don’t start from a new line and don’t have top and bottom margins as block elements have.
Examples of Inline elements:

<a>
    <br>  
    <script&g    t;
    <input>    ;

Q.6) What is the difference between em and strong?

Ans:- In HTML, strong tag is used to specify the importance, seriousness, or urgency of the text used inside it. Contents of strong tags are rendered in bold by browsers. The <strong> element is for content that is of greater importance, while the <b> element is used to draw attention to text without indicating that it's more important.
Similarly we have a em tag which is used to stress emphasis on a word or words of a sentence, perticular sentense or a part of sentense; with intent to affect the meaning of that sentence. Although the visual effects are same, however the semantic meaning is different between the <em> and <i> which is used to epresents text that is set off from the normal prose, such a foreign word, fictional character thoughts, or when the text refers to the definition of a word instead of representing its semantic meaning.


Q.7) What are Attributes?

Ans:- In HTML, attributes are the special words placed inside the opening tags and used to define the characteristics of an HTML element. The HTML attributes contain two parts attribute name and its value. The attribute pairs (attribute_name, attribute_value) are separated using equal (=) operator. The attribute value is closed inside double quotes (” “). The name parameter takes the name of the property we would like to assign to the element and the value takes the properties value or extent of the property names that can be aligned over the element. Every name has some value that must be written within quotes. Further attributes are categoriesed based on their functionalities such as Content attributes, IDL attributes, Boolean attributes and Event attributes. In short attributes can be seen as the properites for the elements.

Syntax=> <element attribute_name="attribute_value"></element>

Examples of attributes are:

<img src=""
         alt=""
         id=""
         class=""
         style="">


HTML Day-2


Q.1) What is the difference between HTML tags and elements?

Ans:- In HTML, tags are the building blocks of a page. Tags tell the browser how it should display content to the user as it consists of a reserverd keywords that have a unique meanings. Tags usually exist in pairs consisting of a starting and an ending tag. However, some tags do not have a closing tag.A tag starts with a > bracket and ends with a < bracket. Most tags exist in pairs in HTML. Tags have an opening and closing part. They are similar, except the closing part has a / sign after the opening bracket.
Elements consists of a generalized component that user wants to display on their HTML page. An element is like the meaningful entity that includes an openning tag, some content and a closing tag. If there is no content in an element, it is called an Empty HTML Element. Also, HTML Elements can be nested. There can be an element with another element as its content.

       Tags:                               Elements:

Opening tag: <TagName>            <p>         --> openning tag
Closing tag: </TagName>               Text    --> content
                                  </p>        --> closing tag

Q.2) Explain br tag.

Ans:- In HTML, br tag is used to produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant. The text after the br tag begins again at the start of the next line of the text block.

Syntax=> 
        <br/>


Q.3) How many different types of lists we have in HTML?

Ans:- A list is a record of short pieces of related information or used to display the data or any information on web pages in the ordered or unordered form. For instance, to purchase the items, we need to prepare a list that can either be ordered or unordered list which helps us to organize the data & easy to find the item.In HTML, there are total 3 types of lists available.

  1. Ordered list defined with <ol> tag. It's used to sort items in ordered manner by using either numbers, alphabets or roman numbers(numbers are used as default).
  2. Un-ordered list defined with <ul> tag. It's used to arrange items in un-ordered manner by using symbols such as disk, square, circle or none.
  3. Descriptive list defined with <dl> tag. It is a list of terms, with a description of each term. The <dl> tag defines the description list, the <dt> tag defines the term name, and the <dd>tag describes each term.

   Ordered list:        Un-ordered lists:        Descriptive list:

   <ol>                  <ul>                     <dl>
       <li></li>             <li></li>               <dt>
       <li></li>             <li></li>                   <dd></dd>
       <li></li>             <li></li>               </dt>
   </ol>                 </ul>                   </dl>

Q.4) What are semantic tags in HTML?

Ans:- In HTML, semantic tags refers to the tags that provide meaning to the HTML page rather than just presentation. It makes HTML more comprehensible by better defining the different sections and layout of web pages. A semantic element clearly describes its meaning to both the browser and the developer. Semantic tags have many advantages over non-semantic tags like the semantic HTML tags help the search engines and other user devices to determine the importance and context of web pages, pages made with semantic elements are much easier to read, it has greater accessibility, offers a better user experience, semantic tags are also of great help to screen readers, and finally they also help in code optimization.


The following HTML tags can be used to break your page into identified parts:


Q.5) Write code to create an ordered list with roman numbers.

Ans:-

<ol type="I">
    <li>
        Item-1
    </li>
    <li>
        Item-2
    </li>
    <li>
        Item-3
    </li>
</ol>

Q.6) Write code to create an unordered list with circle.

Ans:-

<ul style="list-style-type: circle;">
    <li>
        Item-1
    </li>
    <li>
        Item-2
    </li>
    <li>
        Item-3
    </li>
</ul>

Q.7) Write code to create a link to https://www.prepbytes.com

Ans:-

<a href="https://prepbytes.com">
    Click here to go to www.Prepbytes.com
</a>


HTML Day-3


Q.1) Write a code to insert an image.

Ans:-

<img src="https://www.pexels.com/photo/red-concrete-brick-259915/" alt="Alternate text.">

Q.2) Create a form that contains input fields like name, age, email and contact.

Ans:-











Q.3) Create a table and explain how to acheive colspan.

Ans:-

Table without colspan:
Heading-1 Heading-2 Heading-3 Heading-4
td-content-1 td-content-2 td-content-3 td-content-4
Lorem. Lorem, ipsum. Lorem, ipsum dolor. Lorem ipsum dolor sit.

In HTML, we use rowspan attribute to make a cell span more than one row. Rowspan attribute accepts a unitless numerical value, which equals to the number of rows we wanna span. As compared to preceding table, the following table has implementation of rowspan attribute in it's 2nd row of 1st and 3rd column by specifying attribute rowspan="2" .


With colspan:
Heading-1 Heading-2 Heading-3 Heading-4
td-content-1 td-content-2 Lorem, ipsum dolor. td-content-4
Lorem, ipsum. Lorem ipsum dolor sit.

Q.4) Create a radio button (MERN, MEAN : course) and checkbox (HTML, CSS, React, Node : technology) and explain the difference between these two

Ans:- In HTML, radio button and checkbox are the input-type elements, elements through which user provides input. The main difference between radio button and checkbox is that out of multiple available options, with use of radio button user can select only and only one option and with the use of checkbox user can select one or multiple available options. These input elements are primaraly used in HTML forms.

Course :

Technology :



CSS Day-1


Q.1) What is the difference between flex row and flex column?

Ans:- In CSS, flex property is used to define a flexible display to an element(mostly divs). Flex consist of two entities parent flex container and its child flex items and the display: flex property is applied to parent flex container. Then, we have flex row and flex column as property values for flex-direction: property. Basically, flex-direction: row renderes all child flex items in row format i.e. horizontaly on X-axis of a page; whereas flex-direction: column renderes all child flex items in column format i.e. verticaly on Y-axis of a page.

flex-direction: row
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, sapiente?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, sapiente?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, sapiente?
flex-direction: column
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, sapiente?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, sapiente?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam, sapiente?

Q.2) Explain inline , internal and external stylesheets.

Ans:- Cascading Style Sheet(CSS) is used to set the style in web pages that contain HTML elements. It sets the background color, font-size, font-family, color, … etc. property of elements on a web page. There exists 3 ways in CSS can be applied to a HTML page which are as follows:

1. Inline CSS: It contains the CSS property in the body section attached with element is known as inline CSS. This kind of style is specified within an HTML tag using the style attribute.
2. Internal or Embeded CSS: This can be used when a single HTML document must be styled uniquely. The CSS rule set should be within the HTML file in the head section i.e the CSS is embedded within the HTML file.
3. External CSS: External CSS contains separate CSS file which contains only style property with the help of tag attributes (For example class, id, heading, … etc). CSS property written in a separate file which has a .css extension should be linked to the HTML document using link tag. This means that for each element, style can be set only once and that will be applied across web.


Q.3) Justify-content allows you to do what?

Ans:- In CSS, justify-content property defines how the browser distributes space between and around content items along the main-axis of a flex container, and the inline axis of a grid container. The alignment is done after the lengths and auto margins are applied, meaning that, if in a Flexbox layout there is at least one flexible element, with flex-grow different from 0, it will have no effect as there won't be any available space.


Following are some of the values for justify-content property.


Q.4) What is the difference between absolute and relative positioning?

Ans:- Every single element on a web page is a block, iterally a rectangle of pixels. To design a website with complex layouts the use of position: property is required to alter the typical documnet flow and override default browser styling. The position property has five values in total: static, relative, absolute, fixed and sticky . ALso other position specifying properties and values such as top:, bottom:, left:, right: are required in accordance with above position property.

position: relative; changes the position of the element relative to the parent element and relative to itself and where it would usually be in the regular document flow of the page. This means that it's relative to its original position within the parent element. This property value moves the tag based on where it currently is, relative to its usual place and relative to its surrounding tags without affecting their layout. Any element that is a child of the relatively positioned element can be absolutely positioned within that block.

position: absolute; Absolute-positioned elements are completely taken out of the regular flow of the web page. They are not positioned based on their usual place in the document flow, but based on the position of their ancestor. This property value moves the tag irrespective of where it's currently positioned this allows to to literally place any page element exactly where we want it to be. The trade-off about absolute positioning is that these elements are removed from the flow of elements on the page. An element with this type of positioning is not affected by other elements and it doesn’t affect other elements.


Q.5) What is grid-template-columns used for?

Ans:- In CSS, grid-template-columns: is a property associated with grid layouts. This property determines the the number (and the widths) of columns in a grid layout. The values are a space separated list, where each value specifies the size of the respective column.

Syntax=> grid-template-columns: none|auto|max-content|min-content|length|initial|inherit;

Offsets for the property are:


Q.6) What is the z-index in CSS?

Ans:- In CSS, the z-index property specifies the stack order of an element on the z-axis of a page. An element with greater stack order(z-index value) always gets rendered in front of an element with a lower stack order. z-index only works on positioned elements (position: absolute, position: relative, position: fixed, or position: sticky) and flex items (elements that are direct children of display:flex elements). If two positioned elements overlap without a z-index specified, the element positioned last in the HTML code will be shown on top.

Syntax=> z-index: auto|number|initial|inherit;

Offsets for the property are:


Q.7) What is the difference between padding and margin?

Ans:- In CSS, both padding and margin are the properties of box model. Every element can be described in box model layout.

Margin: It is the space around an element i.e. the space outside of an element. It is the space between an element and the elements around it. Margins are used to move an element up or down on a page as well as left or right. Margin is completely transparent, and it does not have any background color. It clears the area around the element. Each side of the element has a margin size you can change individually. In creating the gap, the margin pushes adjacent elements away. It can be negative or any float number or it can also be set to auto.

Padding: It is the space between the element and the related content inside it. It determines how elements look and sit within a container. It also shows the container background around the element in it. Padding can be affected by background colors as it clears the area around the content. To create the gap, it either grows the element size or shrinks the content inside. By default, the size of the element increases.



CSS Day-2


Q. 1) What is box sizing?

Ans:- In CSS, box-sizing: property allows us to include the padding and border in an element's total width and height. By default in the CSS box model, the width and height that's assigned to an element is applied only to the element's content box. If the element has any border or padding, this is then added to the width and height to arrive at the size of the box that's rendered on the screen.
   width + padding + border = actual width of an element
   height + padding + border = actual height of an element

Following are the values for box-sizing: property:


Q. 2) What is animation delay?

Ans:- In CSS, animation-delay: property specifies the amount of time to wait from applying the animation to an element before beginning to perform the animation. The animation can start later, immediately from its beginning, or immediately and partway through the animation. The animation-delay value can be defined in seconds (s) or milliseconds (ms).

Syntax=> animation-delay: time|initial|inherit;

Offsets for the property are:


Q. 3) Which property you will use to merge cells vertically in grid?

Ans:- In CSS,


Q. 4) Which property you will use to merge cells horizontally in grid?

Ans:- In CSS,


Q. 5) Explain CSS box model.

Ans:- In CSS, the term "box model" is used when talking about design and layout. When laying out a webpage, the browser's rendering engine represents each HTML element as a rectangular box according to the standard CSS basic box model. CSS determines the size, position, and properties (color, background, border size, etc.) of these boxes. Every box is composed of four parts (or areas), defined by their respective edges: the content edge, padding edge, border edge, and margin edge.

Margin
Border
Padding
     Content

Content Area:

The content area, bounded by the content's edge, contains the "real" content of the element, such as text, an image, or a video player. Its dimensions are the content width (or content-box width) and the content height (or content-box height). When the box-sizingproperty is set to content-box (default) and the element is a block element, the content area's size can be explicitly defined with thewidth, min-width, max-width, height, min-height, and max-height properties.

Padding Area:

The padding area, bounded by the padding edge, extends the content area to include the element's padding. This area is actually the space around the content area and within the border-box. Its dimensions are the padding-box width and the padding-box height. The thickness of the padding is determined by the padding-top, padding-right, padding-bottom, padding-left, and shorthand padding properties.

Border Area:

The border area, bounded by the border edge, extends the padding area to include the element's borders. It is the area between the box’s padding and margin. Its dimensions are the border-box width and the border-box height. The thickness of the borders are determined by the border-width property. If the box-sizing property is set to border-box, the border area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. When there is a background (background-color or background-image) set on a box, it extends to the outer edge of the border (i.e. extends underneath the border in z-ordering). This default behavior can be altered with the background-clip CSS property.

Margin Area:

The margin area, bounded by the margin edge, extends the border area to include an empty area used to separate the element from its neighbors. This area consists of space between border and margin Its dimensions are the margin-box width and the margin-box height. The size of the margin area is determined by the margin-top, margin-right, margin-bottom, margin-left, and shorthand margin properties. When margin collapsing occurs, the margin area is not clearly defined since margins are shared between boxes.


Q. 6) what is the difference between display none and visibility hidden?

Ans:- In CSS, display: none; and visibility: hidden; both of these properties are different and are used to hide the elements on webpage. But the way they do is completely different as display: none property is type of display property with value as : none; which not only hides but also removes the space which element occupies on a webpage as if it was not written in HTML document in the first place, which disturbes the rest of the element flow on page. Whreas the visibility property with value : hidden; makes the element invisible by making it transparent so our eyes cannot see, but it does occupies space on and its position on webpage unlike when using display: hidden; property, which does not disturbes the elements flow.



CSS Day-3


Q. 1) Replicate the button of PrepBytes.

Ans:-


Q. 2) Write a text and add any google font.

Ans:-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos vero, quis omnis praesentium maxime esse illum tempora qui. Laudantium, omnis alias eum blanditiis saepe a reiciendis explicabo totam necessitatibus. Obcaecati possimus adipisci assumenda dolorem mollitia aliquam, dolorum asperiores at quae necessitatibus quisquam sunt nesciunt neque recusandae voluptatum vel eligendi tempora error delectus odit. Incidunt quos eveniet, voluptate hic officia, exercitationem voluptatem quia nam tempore a velit explicabo saepe vitae asperiores.

font-family: 'Poor Story'; cursive;

Q. 3) Create a box and increase its width on hover , add transition on hover.

Ans:-

BOX
Code=>
            on :hover;
    transform: scaleX(150%);
    transition: all 1s ease-in-out 0s;

Q. 4) Create a circle using border radius.

Ans:-

Code=>
    border-radius: 50%;

Q. 5) Write code to show implementation of media queries.

Ans:- In CSS, a media query is used to apply a set of styles based on the browser's characteristics including width, height, or screen resolution. The @media is a type of At-rule in CSS. These rules will dictate what the CSS will look like based on certain conditions. The media type refers to the category of media for the device. The different media types include all, print, screen and speech. In the below code example a (max-width: 600px) for the media query exissts which tells the computer to target devices with a screen width of 600px and less and changes the background styles for the body to background-color: #87ceeb; .

@media only screen and (max-width: 480px){
    /*Styles go here*/
    body {
        background-color: #87ceeb;
    }
}

Q. 6) Write code to show any animation example.

Ans:-

Code=>
    <div style="width: 250px;height: 250px;border: 3px solid rgb(129 105 149);
    border-radius: 15px;">
        <div style="width: 25%;height: 20%;background-color: darkturquoise;
        border: 2px solid azure;border-radius: 10px;
        animation: box-move 4s ease-in-out infinite forwards normal;
        text-align: center;">
            Box
        <div>
    <div>

CSS Code=>

    @keyframes box-move {
        0% {
            transform: translateX(0);
        }

        25% {
            transform: translateX(280%) rotate(-180deg);
        }

        50% {
            transform: translateX(280%) translateY(358%) rotate(-360deg);
        }

        75% {
            transform: translateY(357%) rotate(181deg);
        }
    }
Box


CSS Day-4


Q. 1) Create masterhead - add background image and put a text at the center , with button below it.

Ans:-

Lorem ipsum dolor sit amet consectetur, adipisicing elit.

Q. 2) Create header -- left side will have logo and right side will have 4 button.

Ans:-

Icon

Q. 3) Create 3 cards of height & width 200 px with texts in it , the card should be horizontally placed in web view and vertically in mobile view.

Ans:-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Ea fuga nam corporis est omnis officiis iure unde, natus dolores a illo temporibus optio quae. Esse officia tempore optio autem explicabo.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Magni aut, doloribus labore enim magnam quos accusamus. Qui blanditiis error tempore delectus nulla id consectetur minus fugiat ad. Corporis, omnis inventore?
Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum in aspernatur veritatis, aut, eveniet nobis ipsa, ab delectus dolor eaque minus accusantium explicabo possimus debitis! Totam quo similique ad nisi.

Q. 4) Create a button like Login and SignUp button of Prepbytes website. "If mobile : buttons color should be green and they should be below each other. If iPad : buttons color should be red and they should be below each other. If desktop : buttons color should be blue and they should be side-by-side each other"

Ans:-


Q. 5) Write code to show implementation of flex.

Ans:-



CSS Day-5


Q. 1) Show implementation of transition.

Ans:-

Box-1

Q. 2) Show implementation of transformation.

Ans:-

Box-1
Box-2
Box-3
Box-4

Q. 3) Show implementation of grid.

Ans:-

Grid-1
Grid-2
Grid-3
Grid-4
Grid-5

Q. 4) What are CSS combinators.

Ans:- In CSS, a CSS selector can contain more than one simple selector. Between the simple selectors, we can include a combinators as they combine other selectors in a way that gives them a useful relationship to each other and the location of content in the document.
There are four types of combinators available in CSS:


Q. 5) What are pseudo selectors in CSS.

Ans:- In CSS, a Pseudo class is a keyword which can be added to slector that's used to define the special state of an element. It can be combined with a CSS selector to add an effect to existing elements based on their states.

selector: pseudo-class{
    property: value;
}

There are many Pseudo classes in CSS but the ones which are most commonly used are as follows: