Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 15, 2021 04:50 am GMT

Day 2: 100 days of code

Pseudo Elements in CSS

Don't try to put pseudo elements on images, it will not work.

The first point to keep in mind is that the before and the after pseudo-elements come before and after "the content" of the container for which they are defined, not before and after the "container".

Showing the position of the before and after pseudo elements

In the below example, the content is not empty.

These are mainly used for design elements, so that we don't have to define two extra divs.

Diving deep into the content property of the before and after pseudo elements.

CSS transition property

Sources:-
css-tricks
MDN

Summary:-
transition is a short hand for 4 different transition properties, which are (in order) transition-property transition-duration transition-timing-function transition-delay .

  • transition-property :- This defines that on the change of which property should we apply a transition. Some examples are: background-color, font-size, transform etc. We can also specity all as the value of this property, indicating that if any of the property of this element changes, apply the transition.

  • transition-timing-function :- Values can be:- ease, linear, ease-in, ease-out, ease-in-out, step-start, step-end.

steps(4,start) :- This means the transition will have 4 steps, and it will start at the instant you hover on the element.

steps(4,end):- Transition will have 4 steps, and it will start after the end of the first time interval(which we calculated by regularly dividing total duration of transition with the number of steps). Don't go into little details in this as it is hardly used.

Multiple animated properites example: -

Few short points that I came to know about

  1. to prevent a text from moving to the next line, you can use white-space:nowrap for that text block.

  2. The focus pseudo class:- Used for styling an element that is currently targeted by the keyboard(through tabbing), or activated by the mouse.

  3. If you want to center an image inside a div, use:-

img{display:block;margin:auto;

as the default value of display for an img element is inline, we must set it to block for margin auto to work for centering.

  1. Remember that the ul and ol have some margin/padding by default. So, whenever you are making a navigation bar or something, make sure to remove that margin/padding. To see the default styling of various html elements, visit this link.

Original Link: https://dev.to/gauravshekhawat/day-2-100-days-of-code-54m

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To