Closing attribute values ​​in HTML and CSS

Three developers, Bob, Bill, and Bruno start building a website, and they start arguing about which way to write HTML markup (and CSS) is best.

All Doctypes = <!doctype html>

Bob writes his markup as follows:

<style type=text/css media=screen>
    #container {
        background-image: url(http://goo.gl/qJKWj);
    }
</style>

<div id=container>
    <div id=header>...</div>
    <div id=content>...</div>
    <div id=footer>...</div>
</div>

Bill writes his markup as follows:

<style type="text/css" media="screen">
    #container {
        background-image: url("http://goo.gl/qJKWj");
    }
</style>

<div id="container">
    <div id="header">...</div>
    <div id="content">...</div>
    <div id="footer">...</div>
</div>

Bruno writes his markup as follows:

<style type="text/css" media="screen">
    #container {
        background-image: url('http://goo.gl/qJKWj');
    }
</style>

<div id="container">
    <div id='header'>...</div>
    <div id='content'>...</div>
    <div id='footer'>...</div>
</div>

As we can see:

  • Bob does not like to attach attribute values ​​with quotation marks of any kind.

  • Bill likes to use double quotes.

  • Bruno sometimes uses quotes, and sometimes does not.

They came to me for advice on how the above examples are best for performance and which are easier on the eyes. Is there a difference between them, apart from cosmetic reasons?

What should I tell them?

+3
source share
4

. (). .

: HTML 4.0 ( 3.2.2), SGML ( HTML) XML XHTML. CSS (.. ) URI ( , - , (. CSS 2, 4.1.2)

+4

, , doctype, HTML . XHTML , , HTML5 , .

/ , , , , , , .

, .

, . !

+2

XHTML/CSS W3C - . . W3C.

0
  • . XHTML, , schieße XHTML
  • Some standards have a design. If everyone has their own thing, code can be a pain to manage.

Essentially, go with what works best. If the problem is just a holy war, who needs it? If they all work on their projects and do everything right, who needs it?

If they all collaborate on the same code, and this starts to be a problem, I would say that you need to choose and run with it. As a side note, I prefer the XHTML syntax.

0
source

Source: https://habr.com/ru/post/1787326/


All Articles