HTML and CSS Interview Questions and Answers

What is HTML?

HTML stands for HyperText Markup Language. It is a language of the World Wide Web. It is a standard text formatting language that is used to create and display pages on the Web. It makes the text more interactive and dynamic. It can turn text into images, tables, links. Complete HTML tutorial.

What are tags? Do all HTML tags have an end tag and why?

HTML tags are the hidden keywords within a web page that define how your web browser must format and display the content.

HTML elements are two types

Non-void elements Most of the HTML tags have a start tag and an end tag that tells us where the element begins and it ends.

Void elements some of the HTML tags don’t require an end-tag or closed symbol(“/”). These kinds of tags are called void elements or empty. the void elements are as follows img, input, hr, area, link, br, meta, base, col, embed, keygen, param, source, track, wb.

Explain the layout of HTML?

HTML layout specifies a way in which the web page is arranged. Every website has a specific layout to display content in a specific manner. The sections of the layout are described. Read More About HTML Layout.

  • Header to define a document or a section header.
  • Main content where the entire web page content is included.
  • Footer to define a document or a section footer.

What is a marquee?

Marquee in HTML is used to put the scrolling text on a web page. It scrolls the image or text up, down, left, or right automatically. You should put the text in which you want to scroll within the <marquee>……</marquee> tag.

Tell me any real-world example of HTML and how will you perform it?

HTML5 standard and set of APIs can be used to support the data entry level of work. As browsers implement new HTML5 standards, developers can simply add the attributes to the tag which indicate required fields, text, data format, etc. HTML5 has come up with several new attributes to drive on-screen keyboards, validation, and other data-entry experiences so that end-user can have a better data-entry.

Hyperlinks in HTML is created by which tag?

The anchor tag that is the <a> tag is used with href attribute which defines the destination and provides the URL of the link, The anchor tag has an opening and closing tag with the source attribute and the link provided in between with blue color

Syntax : <a href="http://www.codebun.com">Hyperlink Text</a>

What is an image map?

Image map lets you link to many different web pages using a single image. You can define shapes in images that you want to take part in an image mapping.

What is a style sheet?

A style sheet is used to build a consistent, transportable, and well-designed style template. You can add these templates on several different web pages. It describes the look and formatting of a document written in the markup language.

Can you create a multi-colored text on a web page?

Yes, we can create a multi-colored text on a web page. To create a multicolor text, you can use <font color =”color”> </font> for the specific texts that you want to color.

What is CSS and what are the different variations of CSS?

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.

The different variations of CSS include:

  • CSS 4
  • CSS 3
  • CSS 2.1
  • CSS 2
  • CSS 1

What are the CSS frameworks?

A CSS framework is a library allowing for easier, more standards-compliant web design using the Cascading Style Sheets language. Most of these frameworks contain at least a grid. … CSS frameworks offer different modules and tools: reset stylesheet. grid especially for responsive web design.

What are the advantages of External Style Sheets?

In External Style Sheets, Classes can be made for use on numerous HTML element types in many forms of the site. In complex contexts, Methods like selector and grouping can be implemented to apply styles.

What is tweening in CSS?

Tweening is the process in CSS mainly used in making animation, it has the property to generate intermediate frames between two images to get the appearance of the first image which develops into the replica of the second image.

Describe Floats and how they work?

Float is a CSS positioning property. Floated elements remain a part of the flow of the web page. This is distinctly different than page elements that use absolute positioning. Absolutely positioned page elements are removed from the flow of the webpage.
Syntax : #sidebar

{

float: right; // left right none inherit

}

What is a CSS selector?

It is a string that identifies the elements to which a particular declaration applies. It is also referred to as a link between the HTML document and the style sheet. It is the equivalent to HTML elements. There are several different types of selectors in CSS:

  • CSS Element Selector
  • CSS Id Selector
  • CSS Class Selector
  • CSS Universal Selector
  • CSS Group Selector

What is the use of % unit?

It is used for defining percentage values.