R
R
RocknRoolla2020-04-19 20:44:09
css
RocknRoolla, 2020-04-19 20:44:09

How to properly assign styles?

I would like to learn more constructively about
how to properly style elements.
Everyone says that to set styles through id bad manners,
but you can also set through tags without using classes.
Which option is better to use and why?

<ul class="nav">
                    <li><a href="" class="nav__link">About</a></li>
                    <li><a href="" class="nav__link">Support</a></li>
                    <li><a href="" class="nav__link">Download</a></li>
                    <li><a href="" class="nav__link">Blog</a></li>
                </ul>

.nav li {
    background-color: #2bff00;
}

.nav__link  {
    background-color: #2bff00;
}

Answer the question

In order to leave comments, you need to log in

11 answer(s)
K
khomaldi, 2020-04-19
@RocknRoolla

BEM can serve as the answer to the question

V
Vaultboy84, 2020-04-20
@Vaultboy84

Something answering, everyone writes some kind of nonsense as if for selection. What's with BEM? This is just a methodology, one of many. The point is not in BEM, but in how styles are read when building a DOM tree. And they are read not from left to right, but vice versa from right to left. Thus, in the first case, all lis in the document are initially taken, then li nested in nav are selected from them. And if you have a lot of li in the document and all styles are written in this way, then everything will be drawn more slowly. By specifying a specific class, you immediately narrow the range and the properties are applied faster when rendering. Thus, it makes more sense to use classes.

M
Migen_ru, 2020-04-20
@Migen_ru

There is a concept of specificity in CSS:
1. id
specificity 2. class
specificity 3. tag specificity
Using tag you will use the least specificity,
using id - the highest specificity. (More details can be found in the book "CSS for the Pros").
Therefore, by using classes you will not override the specificity of id, which in turn is usually used to work with JS scripts.
And using only tag specificity you will need to use a lot of nesting of these tags, and programmers are lazy people, so they use classes as the best option.
And in order to somehow agree on standards, they use one of the methodologies, for example BEM from Yandex (you can have your own if you think that you have it better).

I
Ivan Tikhonov, 2012-01-03
@polym0rph

If there are really a bunch of disks, then it makes sense to make a test bench, any old machine will do. We make a bootable flash drive with MHDD, remove the SATA, ATA and power cables from it, make some kind of stand for them for the tested, at least a bunch of books and go ahead. We connect the screw, we look SMART. If we don’t understand it, then we look at relocated sectors - this is the most important indicator of health. Then press F4 a couple of times and the pancake surface test has already begun, at the end you can judge if there are any bads or sectors where they are likely to appear soon.

K
kornerz, 2012-01-03
@kornerz

Victoria works well under Windows, including Win7 and 64-bit Win7.
Of course, if you use the win version: hdd-911.com/index.php?option=com_docman&Itemid=31&task=view_category&catid=81&order=dmdate_published&ascdesc=DESC

Z
zuborg, 2012-01-04
@zuborg

smartctl to determine disk status.
It also makes sense to run a quick speed test to diagnose problems with the mechanics. For FreeBSD this is `diskinfo -t`, for the rest you can use the banal `time dd if=/dev/sda of=/dev/null bs=1m count=100 skip=1000000` with a script to pull a couple of times in different places on the disk, or some benchmark -then. For a dead screw there will be big delays.
Well, a full surface test, incl. for writing, like `badblocks -v -w -s -b 4096 /dev/sda`. For a screw it will take from half a day to a day, because 4 passes for writing + 4 for reading are required.

R
rinx, 2012-01-03
@rinx

And the standard CHKDSK is not suitable for you?

Z
Zhbert, 2012-01-03
@Zhbert

MHDD for example.
forum.ixbt.com/topic.cgi?id=11:22275 (manual)

D
digdream, 2012-01-04
@digdream

look also in the direction of HDDScan - it helped me with the usb-sata / ide adapter. Shows smart, can scan the surface. www.ihdd.ru/hddscan

A
acDev, 2013-02-24
@acDev

There is also Victoria 4.47 (win x64 is supported).

K
Kusma, 2020-05-22
@Kusma

And if you need to test in batches, if there are 100, 200, 300 disks?
to do from computers of 10 stands? Maybe there are options for ready-made stands?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question