If you attach it to many elements such as the hover effect of a tag, would you like to make it multi-class considering its expandability?

Asked 2 years ago, Updated 2 years ago, 95 views

If you attach it to many elements such as the hover effect of a tag, would you like to make it multi-class considering its expandability?
Or would you like to use the tag name as there are too many class names?

·1
a:hover{}

·2
.animation:hover{}

Now I'm using the class without using tag names as much as possible, so I'm doing that. You will see the following, but do you think there is no problem with this?

<div class="c-card c-card --margin-bottom u-gradient-lightgreen u-boxshadow-small js-hook-animation-fadein --scroll-long u-transition-all-500msp-is-hidden">

css

2022-09-30 21:20

1 Answers

I don't know the big picture, so it's a general story, but

Direct element
if applicable to the entire page CSS:

a:hover{}

If within a particular delimited range, add id (one on the page, such as the navigation bar) or class (multiple scattered) to the element surrounding that part. HTML:

<ulid="nav>
    <li><a>Home>/a></li>
    <li><a>Download</a></li>
</ul>

CSS:

ul#nava:hover{}

a is directly appended to class if it is not specifically regular and scattered. CSS:

 a.animation:hover{}

That's what I'm doing.

I don't know what kind of site it is, so it may be off the mark, but instead of specifying class through movements such as animation and scroll, I think it's normal to separate class through the role of the site such as header and album image.All album images will look and move in the same way, but the navigation bar is not often the same.

If it's just the amount of processing, I think it's an error up to a few dozen of the current PCs and smartphones, so if you really need it, there's no problem with a lot of them.


2022-09-30 21:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.