Why some names, for example, are not against hidden, but href vs. Are src so inconsistent in CSS and HTML?

Hi, this is a more conceptual question. How did the W3C decide to use hidden versus none ? I ask because I am an ESL person (English as a second language). If I use overflow: hidden , overflow: none could be used. The same goes for display: none and visibility: hidden . Could it not be display: none and visibility: none , because the display and visibility properties really matter, not their value. This is more please explain. Similar "strange" things happen, for example:

 <script src="file.js"> 

and

 <link href="file.css"> 

Why are they different? I understand how it all works technically, I just wonder how they defined the names of the attributes.

Thanks.

+4
source share
1 answer

The reason that these objects (elements, properties, attributes, etc.) are called different is because they serve different purposes. Start from the top and see your examples.

Display vs Visibiliy

 display: none; visibility: hidden; 

As you can see from the CSS 2.1 specification , the value none used for many different properties to indicate that the visual aspect of the property should not be displayed. Therefore, if the property is float , none means that the element is not floating. For the display property, none means that it is not displayed.

For visibility , hidden is different, since it is different from display , it does not affect the element flow. The block of elements will still be displayed, but it will be invisible. If you gave none to visibility , it would semantically mean the same as display: none , which is not the case.

Overflow

 overflow: hidden; overflow: none; 

These are different things. hidden says that content that overflows the size of the element will be clipped, and none says there is no overflow control; essentially overflowing. none not a valid value for overflow , but in this case visible has the same effect.

Src vs href

 <script src="file.js"> <link href="file.css"> 

The difference between a script and link is that while the main task of the script is to embed (inline or via the link via the src attribute) a script inside an HTML document, the target of link refers to other URIs on the World Wide Web. The fact that you use link to link to a CSS stylesheet is not very intuitive; a more intuitive solution might be:

 <style src="file.css" /> 

I have no information on why the HTML working group chose to use link rather than style , but from a little digging it seems that the link element was already present in HTML 1.0 and HTML 2.0 and that style not introduced before HTML 3.0 .

In discussions on the style language that started back in 1993 (HTML 1.0 was completed the same year) and HTML 3.0 was not done until 1995, it makes sense that they found a way to embed stylesheets before they were invented style element.

+11
source

All Articles