In this post, you’ll learn about commonly asked HTML and CSS interview questions and answers for freshers. So, let’s see the question and answers below.
What is HTML?
HTML is a markup language whose complete form is Hyper Text Markup Language. It’s used to make documents and web pages and it was created in 1991 by Berners-Lee. The latest version of HTML is HTML5 with this we can build games and interactive websites more easily.
What is CSS?
Cascading Style Sheets are widely prevalent among developers as CSS. From web apps to software it’s used by every developer to provide style sheets on their software. By using CSS you can manipulate HTML elements for example body, heading, paragraph, text, etc. if you want to learn more about CSS get our new eBook to learn CSS and HTML.
Does a hyperlink apply only to text in HTML?
No, you can use it with images and HTML elements also. For example <a href=”https://developersnation.co.in”><img src=logo.png></a> this way you can use hyperlinks with image tags.
Do all HTML tags have an end tag or a closing tag?
In HTML there are some tags known as empty tags. And they don’t have any closing tags. For example <br> tag has no closing tag.
How to include CSS in the webpage?
You can include CSS in HTML by using three modes which are the following.
- Inline CSS style can be provided inside the HTLM elements. For example <h2 style=”color: green;”> Developers Nation </h2> here you can see we’re providing green color to the h2 element.
- Internal CSS here you make the CSS style in separate tags using <style> tag. And declare all the CSS styles in this tag. And you can find this <style> tag in the <head> tag section.
- External CSS is the next level of internal CSS where you put the whole CSS style in the different CSS files and link this file in HTLM pages using <link> tag.
So, This way you can include CSS style in the HTML page. And if you want to learn HTML and CSS in a proper manner. You can buy this Learn HTML & CSS: Make Bio Link Tree Project & Publish with GitHub Pages where you can make a link tree project using what you learn in this book. And you can share this web page with the world using the GitHub page.
What are the different types of Selectors in CSS?
There are mainly three kinds of selectors that are widely used by web developers. These are called class, Id, and element selectors. Also, there are other selectors available for example Universal, Group, and Attribute selectors. And there are Pseudo Class and Pseudo Element Selectors also there.
We can use class selectors using dot (.) and Id selectors by using Hash (#) also with using the element name can be used as selectors. For example, the H1 tag and Paragraph tag is very common HTML element selectors.
Explain the layout of the HTML
The layout is something like the blueprint of any website which follows the traditional rule of designing a website. For example, on any web page, you can find the head, footer, and main body content. These are fundamental things that you need to make a website layout.
On the modern website, you can find the header, Navigation bar, Sidebar, or Index, the central area of the content section, and the footer section. For a better understanding see the below figure.
What is the difference between Block, Inline, and Inline Block In CSS?
The block property displays the element in a block manner for example stack of boxes. Because in the display: block property the line break happens after the element and the element is not able to sit to the next elements.
In the display: inline property it’s not allowed to put the width, height, and padding property to stick with the elements. If there is any kind of width, height, or padding available it’s not respected and sometimes it overlaps other elements.
And display: inline-block gives you a better way to make side-by-side boxes with the better property of collapsing and wrapping to the element depending on the available space in the containing element.
So, in conclusion, the basic difference in the block, inline, and inline-block properties is that in block property you can make property boxes stack each other without overlapping each other. On the other hand, you can create overlap and side-by-side elements using the inline property.
And if you want both block and line properties you can use the inline-block display property to make side-by-side elements without overlapping the other elements.
What will happen if you overlap sets of tags?
When tags overlap, only the first stage will show on the screen. This will happen because tags are not arranged in a hierarchical manner.
What is a marquee?
So, these are the HTML and CSS interview questions for freshers. Also, if you want to learn HTML and CSS by doing a project you can buy this Learn HTML & CSS: Make Bio Link Tree Project & Publish with GitHub Pages from amazon and learn web design effortlessly.
In this book, we put our experience and learning to make you learn HTML and CSS easily. Unlike other eBooks, you can make a project using what you learn and share it with the world. So, buy it now and get your ebook from amazon.