Top 50 CSS Interview Questions with Answers

CSS Interview Questions with Answers
  1. What does CSS stand for?
    A. Creative Style Sheets
    B. Cascading Style Sheets
    C. Continuous Style Sheets
    D. Coordinated Style Sheets

Answer: B

  1. Which of the following is not a CSS property?
    A. font-style
    B. text-transform
    C. background-color
    D. image-radius

Answer: D

  1. What is the syntax for creating a CSS class?
    A. .class_name {}
    B. class_name {}
    C. #class_name {}
    D. ?class_name {}

Answer: A

  1. Which property is used to change the background color of an element?
    A. color
    B. background-color
    C. text-color
    D. none of the above

Answer: B

  1. Which property is used to add spacing between lines of text?
    A. line-height
    B. spacing
    C. letter-spacing
    D. none of the above

Answer: A

  1. What is the CSS box model?
    A. It is a way of describing how elements are displayed on a web page
    B. It is a way of describing the layout of a web page
    C. It is a way of describing the margins, borders, padding, and content of an element
    D. It is a way of describing the colors used on a web page

Answer: C

  1. What is the default display property of a element?
    A. block
    B. inline
    C. inline-block
    D. none of the above

Answer: A

  1. Which property is used to add a border to an element?
    A. border-style
    B. border-size
    C. border-color
    D. all of the above

Answer: D

  1. Which property is used to change the font of an element?
    A. font-family
    B. font-size
    C. font-style
    D. all of the above

Answer: A

  1. Which property is used to create a drop shadow effect on an element?
    A. text-shadow
    B. box-shadow
    C. element-shadow
    D. none of the above

Answer: B

  1. What is the default value of the position property?
    A. static
    B. relative
    C. absolute
    D. fixed

Answer: A

  1. Which property is used to change the opacity of an element?
    A. opacity
    B. transparent
    C. visibility
    D. none of the above

Answer: A

  1. Which property is used to create columns of text on a web page?
    A. column-gap
    B. column-count
    C. column-width
    D. all of the above

Answer: D

  1. What is the difference between padding and margin?
    A. Padding is the space between an element and its border, while margin is the space between an element and the next element
    B. Margin is the space between an element and its border, while padding is the space between an element and the next element
    C. Margin is the space between an element and a wall, while padding is the space between an element and a cushion
    D. Padding and margin are the same thing

Answer: B

  1. What is the difference between absolute and relative positioning?
    A. Absolute positioning positions an element relative to the viewport, while relative positioning positions an element relative to its parent element
    B. Absolute positioning positions an element relative to its parent element, while relative positioning positions an element relative to the viewport
    C. Absolute positioning positions an element in the center of the page, while relative positioning positions an element to the left or right of the page
    D. Relative positioning positions an element in the center of the page, while absolute positioning positions an element to the left or right of the page

Answer: A

  1. Which property is used to align text within an element?
    A. text-align
    B. text-justify
    C. text-indent
    D. all of the above

Answer: A

  1. What is the syntax for applying a style to a specific element?
    A. element style {}
    B. style element {}
    C. element {style}
    D. style {element}

Answer: C

  1. Which property is used to create an underline effect on text?
    A. underline
    B. text-underline
    C. text-decoration
    D. none of the above

Answer: C

  1. Which property is used to create a strikethrough effect on text?
    A. strike
    B. text-strike
    C. text-decoration
    D. none of the above

Answer: C

  1. Which property is used to create a bold effect on text?
    A. bold
    B. font-weight
    C. font-style
    D. none of the above

Answer: B

  1. Which property is used to create an italic effect on text?
    A. italic
    B. font-style
    C. text-style
    D. none of the above

Answer: B

  1. Which property is used to add an image as a background to an element?
    A. background-image
    B. image-background
    C. background-color
    D. all of the above

Answer: A

  1. Which property is used to control the amount of white space between words?
    A. word-spacing
    B. letter-spacing
    C. line-height
    D. none of the above

Answer: A

  1. Which property is used to add a gradient effect to an element?
    A. gradient-effect
    B. background-gradient
    C. linear-gradient
    D. none of the above

Answer: C

  1. Which of the following is not a valid value for the display property?
    A. block
    B. inline
    C. flex
    D. side

Answer: D

  1. Which property is used to create an outline around an element?
    A. outline-style
    B. outline-color
    C. outline-width
    D. all of the above

Answer: D

  1. Which property is used to change the size of an element?
    A. width
    B. height
    C. both a and b
    D. none of the above

Answer: C

  1. What is the difference between em and rem units?
    A. Em is relative to the font-size of the parent element, while rem is relative to the font-size of the root element
    B. Rem is relative to the font-size of the parent element, while em is relative to the font-size of the root element
    C. Em is a fixed size unit, while rem is a variable size unit
    D. Rem is a fixed size unit, while em is a variable size unit

Answer: A

  1. Which property is used to center an element horizontally within its container?
    A. text-align
    B. margin
    C. padding
    D. none of the above

Answer: A

  1. Which property is used to center an element vertically within its container?
    A. vertical-align
    B. text-align
    C. margin
    D. padding

Answer: A

  1. What is the difference between inline and block elements?
    A. Block elements take up the full width of their container, while inline elements only take up the space needed by their content
    B. Inline elements take up the full width of their container, while block elements only take up the space needed by their content
    C. Inline elements are always displayed in a single line, while block elements can be displayed in multiple lines
    D. Block elements are always displayed in a single line, while inline elements can be displayed in multiple lines

Answer: A

  1. Which property is used to add spacing between the border and the content of an element?
    A. padding
    B. margin
    C. border-spacing
    D. none of the above

Answer: A

  1. Which property is used to add an image to a web page?
    A. image-src
    B. img-url
    C. src
    D. all of the above

Answer: C

  1. Which property is used to create a transition effect on an element?
    A. transition
    B. transition-effect
    C. transition-duration
    D. all of the above

Answer: A

  1. Which property is used to create an animation effect on an element?
    A. animation
    B. animation-name
    C. animation-duration
    D. all of the above

Answer: A

  1. What is the difference between padding-left and padding-right?
    A. Padding-left adds space to the left of an element, while padding-right adds space to the right of an element
    B. Padding-right adds space to the left of an element, while padding-left adds space to the right of an element
    C. Padding-left and padding-right are the same thing
    D. None of the above

Answer: A

  1. What is the difference between CSS and HTML?
    A. CSS is used to style the layout of a web page, while HTML is used to structure the content of a web page
    B. HTML is used to style the layout of a web page, while CSS is used to structure the content of a web page
    C. CSS and HTML are the same thing
    D. None of the above

Answer: A

  1. Which property is used to change the color of text?
    A. color
    B. text-color
    C. font-color
    D. none of the above

Answer: A

  1. What is the difference between a class and an ID in CSS?
    A. A class can be applied to multiple elements, while an ID can only be applied to one element
    B. A class can only be used once, while an ID can be used multiple times
    C. A class is used for styling text, while an ID is used for styling images
    D. None of the above

Answer: A

  1. What is the difference between a pseudo-element and a pseudo-class in CSS?
    A. A pseudo-element is used to style a part of an element, while a pseudo-class is used to style a state or condition of an element
    B. A pseudo-class is used to style a part of an element, while a pseudo-element is used to style a state or condition of an element
    C. A pseudo-element and a pseudo-class are the same thing
    D. None of the above

Answer: A

  1. Which property is used to add a border-radius to an element?
    A. border-radius
    B. border-style
    C. border-size
    D. none of the above

Answer: A

  1. Which property is used to create a shadow effect on text?
    A. shadow-effect
    B. text-shadow
    C. shadow-text
    D. none of the above

Answer: B

  1. What is the difference between a child selector and a descendant selector in CSS?
    A. A child selector only selects direct children of an element, while a descendant selector selects all children of an element
    B. A descendant selector only selects direct children of an element, while a child selector selects all children of an element
    C. A child selector and a descendant selector are the same thing
    D. None of the above

Answer: A

  1. What is the difference between a relative and absolute unit in CSS?
    A. A relative unit is based on another value, while an absolute unit is a fixed value
    B. An absolute unit is based on another value, while a relative unit is a fixed value
    C. A relative unit and an absolute unit are the same thing
    D. None of the above

Answer: A

  1. Which property is used to create a vertical menu on a web page?
    A. vertical-menu
    B. menu-direction
    C. display
    D. none of the above

Answer: C

  1. What is the difference between a serif and sans-serif font?
    A. Serif fonts have decorative lines at the end of each character, while sans-serif fonts do not
    B. Sans-serif fonts have decorative lines at the end of each character, while serif fonts do not
    C. Serif and sans-serif fonts are the same thing
    D. None of the above

Answer: A

  1. Which property is used to create a gradient colored background on an element?
    A. background-gradient
    B. linear-gradient
    C. color-gradient
    D. none of the above

Answer: B

  1. Which property is used to create a transition effect on the color of an element?
    A. transition-color
    B. transition-style
    C. transition-duration
    D. none of the above

Answer: A

  1. What is the difference between min-width and max-width in CSS?
    A. Min-width sets the minimum width of an element, while max-width sets the maximum width
    B. Max-width sets the minimum width of an element, while min-width sets the maximum width
    C. Min-width and max-width are the same thing
    D. None of the above

Answer: A

  1. What is the difference between display: none; and visibility: hidden; in CSS?
    A. Display: none; removes the element from the page, while visibility: hidden; hides the element but keeps it in the page
    B. Visibility: hidden; removes the element from the page, while display: none; hides the element but keeps it on the page
    C. Display: none; and visibility: hidden; are the same thing
    D. None of the above

Answer: A

How can we understand Django?

Hello, my loving friends, today in this article. We are going to deliver a brief description of Django. In this course details, we are covering the prominent part of Django for beginners. If you are a python learner or a seeker then this is the exact place for any individual those have been looking for. In this topic, we have covered all the beneficiary subjects regarding this course. I will really say that this will give you the best experiences of your doing and what you are going to do.

What is Django?

Django

Django is a free and open-source web framework. Now you will say it is ok we don’t know about the free part and its open-source part but what is a framework? Now. The framework is a combination of certain components and packages. Definitely, if you want to build some complex application. There are certain things that you need to make. For example, if you want to make a web application. You don’t want anything from scratch. It will be time-consuming. So, you will be using a framework here. Now, Django is not the only framework that’s only available.            

Why use the Django framework?

Django framework

One of them is and one of the famous ones is Django. Why do we have to learn Django there? Django as we know is a web application framework that means you can build web applications. But hold on, our websites are so important definitely. If you talk about any business, they need their own online presence. In fact, most of the virtual solutions which you use nowadays are web applications. For example, if you want to buy something online, we have amazon, flip kart, and eBay. If you want to book a cab, you have an uber. We have so many applications available which are based on the web. If you want to build them, you will be using Django there. But you talk about the websites, we know that you can build websites with the help of HTML, CSS, & JavaScript. So, basically, we use HTML to design the page. You can think of HTML as makeup for you. Now that you have CSS, if you want to improve your design, if you want to have that uniformity in the design that’s you will use CSS. We have Html, CSS for design. To make your websites interactive, you can use JavaScript.

Static and dynamic website

Yes, you use HTML, CSS, and JavaScript in the front hand. What about the backhand part? What if you want to make a website like a dynamic website? For example, if you go to Facebook, everyone will get influent by the feeds, you will not see the same messages which everyone is seeing. Your Facebook is different from that. If you go to amazon, you can buy stuff online, you can pay, and you can transfer the amount online. All these things need certain operations and certain processing is done on the backhand side. That’s where we need a line base that will work on the backhand but which one? But we have certain options there, we have java using, if you have heard about servlet, you can do that, PHP, Asp, and Python. But hold on, how can you do that python?          

How Django can be used?

That’s where we have Django. So, you can use Django to build a web application in the backhand part in python. As I mentioned before, Django is not the only web framework is available but it’s quite famous there. Now, it comes to web applications one thing that is very famous in MVC. It doesn’t matter which language you learn maybe java, PHP, or asp. We have this thing common in MVC (Model view controller). Now. Basically, we do that you can separate the concerns. We have a model for data, view the Html format that you have seen on the screen and then we have a controller which will control these operations.          

What is MVT in Django?

But in general, when you say MVC, it will help you to build a good web application but in Django, we have something similar to MVC not exactly MVC normally call as MVT. So, MVT is a model view template so basically in MVT we are replacing the controller with a view and replacing the view with the template. But Django basically follows MVT so, if you have worked on MVC in a different language. Don’t worry, it’s almost the same but needs some changes. But why did you choose Django? When you have some other framework is available in python. The first Reason is Django is fast, which simply means if you want to build something, you shouldn’t be spending much time in the configuration so, Django will help you to build applications faster. The second one is the number of components available.

The thing apart from if you record a video, you need some components with you. You need a camera, lights, and mike, in the same way, if you want to build a web application. You need log in, database connectivity, all these things come bundled in Django. Does advantages and drawbacks as well, advantages you have everything with you and drawback, you have everything on you. The third one is security if you are building an application where you use it. Definitely, there will be sending the data and you want to secure them & the users. So, Django will provide you with that security. The fourth one is scalability, what if in future sites scales, you want to have multiple users, & more features and it will give you the options as well. That’s the reason, you should be learning Django. It is interesting so if you have done your python course. This is the very true place and accurate learning path for you.

Tagged : / / / / / / / /

How to create creative CSS pop up effect & image hover effect clip path property using HTML & CSS?

In this blog, I am creating careative CSS pop up effect & image hover effect clip path property using HTML & CSS. So, Let’s create an index.html & style.css below-

Creative CSS pop up effect using CSS clip path property after hover effect
Creative image hover effect using CSS clip path after hover effect
Image to circle hover effect using CSS clip path property after hover effect
Tagged : / / / / / / /

How to create a line loading effect & growing lines loading animation using HTML & CSS?

In this blog, I am creating a line loading effect & growing lines loading animation using HTML & CSS. So, Let’s create an index.html & style.css below-

Growing lines loading with CSS animation
Line loading effect
Nice loading effect
Nice loading effect with CSS animations
Ring loading effect
Nice loading effect with CSS animations
Tagged : / / / / / /

How to create a nice loading effect & preloader animations using HTML & CSS?

In this blog, I am creating a nice loading effect & preloader animations using HTML & CSS. So, Let’s create an index.html & style.css below-

Loading effect with CSS animations
Loading effect with CSS animations 2
Preloader using CSS animations
Tagged : / / / / /

How to create Simple Images, Slider Show, & Changing background color with animations using HTML & CSS?

In this blog, I am creating simple Images, Slider Show, & Changing background color with animations using HTML & CSS. So, Let’s create an index.html & style.css below-

Simple Images Slider Show with CSS animations
Changing background color with CSS animations
Tagged : / / / / / / / / /

How to create Icon Hover Effects with Transitions and Animations using HTML & CSS?

In this blog, I am creating a Icon Hover Effects with Transitions and Animations & awesome pulse effect using HTML & CSS. So, Let’s create an index.html & style.css below-

Awesome pulse effect using css animations
Icon Hover Effects with CSS Transitions and Animations before hover
Icon Hover Effects with CSS Transitions and Animations after hover
Tagged : / / / / / /

How to create a button-shaking hover effect animation & lighting text animation using HTML & CSS?

In this blog, I am creating a button-shaking hover effect animation & lighting text animation using HTML & CSS. So, Let’s create an index.html & style.css below-

Animated button with CSS animation before hover

Animated button with CSS animation after hover

Animated text background with css animation
Lighting text with CSS animation
Button shaking hover effect with CSS animation before hover

Button shaking hover effect with CSS animation after hover

Tagged : / / / / / /

How to use floating text animation & text rotator animation using HTML & CSS?

In this blog, I am creating floating text animation & text rotator animation using HTML & CSS. So, Let’s create an index.html & style.css below-

Floating text using CSS animation
Text rotator using CSS animation
Tagged : / / /

How to create a creative rotated text border effect & social media icons hover transforms using HTML & CSS?

In this blog, I am creating a creative rotated text border effect & social media icons hover transforms using HTML & CSS. So, Let’s create an index.html & style.css below-

Creative rotated text border effect using CSS transforms after hover
Fill Text Effect On Hover before hover
Fill Text Effect On Hover after hover
social media icons hover effect with CSS transforms before hover
social media icons hover effect with CSS transforms after hover
Tagged : / / / / / / / / /