CSS border property is used to set the border of an HTML element.
The border property is shorthand for three sub-properties that define the style, color, and width of a border.
border: 1px solid red;
border: border-width border-style color;
Sets the thickness of the border. Defaults to medium if absent.
border-width: thin | medium | thick;
border-width: border-top-width border-right-width border-bottom-width border-right-width;
border-width: 0 4px 8px 12px;
Sets the style of the border. Defaults to none if absent.
border-style: none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset
Sets the color of the border. …
Selectors are used to selecting elements in an HTML document, in order to attach (style) properties to them.
The most used CSS selectors are by
class and by
id, nevertheless, there are many selectors which you can use easily and fairly to add styles into a set of elements.
B. Attribute Selector
C. Pseudo Selector
D. Pseudo Classes
In this article, I will be talking about different selectors beyond class and id and will be covering Combinators and Attribute Selector.
We will be using the below HTML snippet for all the Attribute Selector:
Centering an element horizontally and vertically is a very common interview question. Suppose there is a parent element surrounding the child element:
<div class="child">hello world</div>
Flexbox control how items are placed and how empty space is distributed in ways that would have required either magic numbers in CSS for a specific number of elements.
Depending on the flex-direction, we might use justify-content or align-items to adjust as needed.
CSS Grid includes pretty much the same alignment options as flexbox, so we can use it on the…