HTML & CSS

Hyper Text Markup Language

1. HTML4 VS XHTML VS HTML5

2. What is <!Doctype>

Tells the browser about the version of HTML used

<a target = "_blank" href="www.google.com">

4. How many ways you can write CSS?

3 ways

3 ways to style your html

6. How to group the css?

Basic grouping
basic grouping

7. Box-Modal

Content-box (default )

content-box: width and height will be defined for content. The box width upto the border with be added to content

Border-box

Border-box : This is better

8. CSS properties on all elements (presets we can follow)

9. Out of two paragraphs, how do you change the color of the first paragraph?

10. How do you select all p tags inside div tag in a simple way?

div p{}

Using class or id you can also select like this

.first .para{}

11. How to select only direct span children elements of a div tag?

direct children >

12. How to arrange elements side by side or in any layout in CSS?

3 ways to arrange elements

  • Using floats (old way and require hacks like clearfix)

  • Flex-box (2D layouts)

  • Grid (3D layouts)

13. Which is the default CSS position?

static position is the default. If you want to specify top, bottom, and so on then use position relative or absolute.

14. What are floats and how to clear floats?

Float video 1
Float video 2
Float video 3

15. How do you make the two paras appear side by side without using flexbox or grid?

Using float as done above

16. Set background image in CSS.

17. CSS Selector - nth-of-type vs. nth-child

Both do the same thing sometimes so might get confused. Please watch this

18. The easiest way to align the container/ block-level element horizontally

19. The easiest way to align the block-level element vertically

20. When to use vertical-align:middle?

We can use this when working with inline or inline-block elements in two contexts.

  • Center content in a table cell

  • Center an image or icon placed along with the text

21. And condition css

This is a part of Expanding cards project. Checkout my git repo

22. ::before and ::after pseudo elements

Note that we can't apply pseudo elements on images as they don't have the content. In other words, we can apply for an element like p because it has the content or text and we can apply ::after after the text and ::before before the text, but not for images.

23. Can you modify :: pseudo class with JS?

No, you can't. You could do it with Jquery but not with Vanilla JavaScript. Define another class which can do it instead of ::before or ::after pseudo class.

24. CSS Selectors

5 type of selectors

Combinator selectors
Attribute selectors

25. On hovering on an element, can I change the style on some other element?

https://stackoverflow.com/questions/6910049/on-a-css-hover-event-can-i-change-another-divs-styling

26. CSS Grid

You should know all grid properties by heart

Till now we learned basics of grid like how to align container and items. There is another way of doing things in grid where we specify a name to each item and then place it in the container (literally saying how this item should be and where it should be placed in the container). The below video timestamp for this one is 18.48

27. Border vs Outline

The CSS border properties allow you to specify the style and color of an element's border.

An outline is a line that is drawn around elements (outside the borders) to make the element "stand out".

Last updated

Was this helpful?