TOP-12 Interview Questions in HTML and CSS - ByteScout
  • Home
  • /
  • Blog
  • /
  • TOP-12 Interview Questions in HTML and CSS

TOP-12 Interview Questions in HTML and CSS

TOP Interview Questions in HTML and CSS

HTML Interview Questions

1. Describe the two types of web storage in HTML5.

Answer: the two types of storages in HTML5 are

Local storage: this storage property allows data storage without any expiration date. The storage of data for the given website is done on a permanent basis. It will not be deleted even if the browser gets closed. This means data will be stored till the next day, week, or year unless it is removed by the user. It has the property of reading only.

Session storage: this is another type of web storage in HTML5. It stores the data of the current session only. Data gets deleted automatically as soon as the browser tab is closed.

2. What is semantic in HTML?

Answer: Semantic HTML gives meaning to the web page rather than just presentation. It is a coding style that focuses on using HTML markup to reinforce the semantics or importance of the content. The semantic elements are used to define different parts of a web page. It is processed by traditional web browsers as well as by many other user agents.

Example:In semantic HTML, <b> </b> tag is not used for bold statements as well as <i> </i> tag is used for italics. Instead of these we use <strong></strong> and <em></em> tags.

3. What is an image map?

Answer: The image map is defined by the < map> tag. An image map is an image with clickable areas. You can define different shapes in images that you wish to take part in an image mapping. Image map enables you to link to many other web pages using a single image.

4. What are applets?

Answer: Applets are used to embed java applets into  HTML documents with the help of the <Applet> tag. It was previously supported in HTML4.01 but it was discontinued after the release of HTML5. <applet> tag was used to embed Small programs within web pages to perform some specific functionality, such as computations, animations, and information processing.

5. Give some advantages of collapsing white space.

Answer: White spaces are a blank sequence of space characters treated as a single space character in HTML. It reduces the bytes transmitted in the HTML file by removing whitespace. Since the browser collapses multiple spaces into a single space, the indentation of text lines can be done without worrying about various spaces. This helps the user to organize the HTML code into a much more readable format.

6. What is the difference between HTML and XHTML?

Answer:The differences between HTML and XHTML are:

HTML is an application of Standard Generalized Markup Language. In comparison, XML is an application of Extensible Markup Language.

The first one is a static Web Page, whereas the latter one is a dynamic Web Page.

HTML allows programmers to perform changes in the tags and use attribute minimization, whereas in XHTML when a user needs a new markup tag, the user can define it in this.

HTML is about displaying information, whereas XHTML is about describing the information.

CSS Interview Questions

7. State the different ways to include CSS with HTML.

Answer: There are three ways to CSS with HTML. These are:

Inline CSS: It is used for styling small contexts. To use inline styles, add the style attribute in the relevant tag.

External Style Sheet: This is used when the style is applied to many pages. The <link> tag works inside the head section. All the pages must be linked to the style sheet using the <link> tag.

<head>
<link rel="stylesheet" type="text/css" href="mystylesheet.css" />
</head>

Internal Style Sheet: It is used when a single document has a unique style. Internal styles sheet needs to put in the head section of an HTML page, by using the <style> tag in the following way:

<head>
<style type="text/css">
hr {color:sienna}
p {margin-left:70px}
body {background-image:url("images/back60.gif")}
</style>
</head>

8. What are gradients in CSS?

Answer: This is a CSS property in which you can display a smooth transformation between two or more than two specified colors.

The two types of gradients in CSS are

  • Radial gradient
  • Linear gradient

9. Define the CSS box model and name its elements.

Answer: this box is used to define the design layout of the elements in CSS. The elements are:

  • Margin: this is the topmost layer in which the overall structure is shown
  • Border: in this, the padding and the content option with a border around it are shown. The border is affected by the Background color.
  • Padding: Space is shown through this method. The border gets affected by the Background color.
  • Content: this element gives you the property to go through the Actual content.

10. Mention the different types of cascading methods that are used inside the cascading order.

Answer: Cascading order is itself one of the sorting methods that allow many other sorting methods to work inside them. Below is the list of cascading elements

a) Sort by origin: in this method. There are some rules which can provide an alternate way of definition

  • The normal weight of the style sheet used by a particular provider will be overridden due to the increased importance of the user’s style sheet.
  • Rules of the stylesheet of a specific user will be overridden from the normal width by the provider’s style sheet.

b) Sort by selector’s specificity. The more specific selector is overriding, the less specific selector.

For Example, A contextual selector is less specific than the ID selector, which is a more specific one, and with that, the contextual selector is overridden by the ID selector.

c) Sort by order specified. This comes in the scenario when the two selectors are of the same weight and the other properties than the specification, which will be seen for overriding.

For example:

If we use the style attribute for inline style, all other styles will be seen overridden.

If we use the link element for external style, it will override the imported style.

11. What do you mean by tweening?

Answer: Tweening is the process that allows us to create intermediate frames between two images to get the appearance of the first image, which develops into the second image.

Its main purpose is to create animations.

12. What are the limitations of CSS?

Answer: some of the major limitations of CSS are:

  • Ascending by selectors is not possible.
  • It has Limitations of vertical control.
  • It doesn’t give us the facility to use expressions.
  • CSS doesn’t provide column declaration.
  • The dynamic behavior possessed by CSS does not allow control over its dynamic behavior.
  • CSS doesn’t support the extra properties such as Rules, styles, or targeting specific text.
   

About the Author

ByteScout Team ByteScout Team of Writers ByteScout has a team of professional writers proficient in different technical topics. We select the best writers to cover interesting and trending topics for our readers. We love developers and we hope our articles help you learn about programming and programmers.  
prev
next