Is using the logo tag in sprites good or bad?

后端 未结 14 654
攒了一身酷
攒了一身酷 2021-02-05 05:31

When building web pages, one of my colleagues displays any logo using the CSS background-image property, rather than embedding the image using an HTML t

14条回答
  •  天涯浪人
    2021-02-05 06:02

    There is no reason not to use sprites for optimization, even if the image logo is semantic information. The overall meaning (sēmantikós) of the page is not lost if the use of sprites is done adeptly, namely by use of the image within a properly identified container. There is no universally agreed upon semantic web – semantics is a philosophical art, and open to heavy interpretation.

    Perhaps arguably, more appropriate than an image for a logo is a heading (h1, by its very definition) set as a block element with visibility hidden. The text becomes searchable, carries semantic meaning for the page (allowing a proper replacement of content in text-based browsers and screen readers), and the background of the h1 set to the positioning of the sprite as necessary.

    There are arguments for both sides, at least from the SEO point of view – each image is a searchable object, and an opportunity for inbound traffic; but each http request takes up bandwidth and slows the load time of the page, making it less optimized and thus lower-ranking.

    edit:

    When you have 3 or more logos, the point of http requests is moot; subsequent logos would presumably be the same image, even if resized. If not, reconsider why you're using the logo thusly.

    If they are 3 different logos for the same company, they are no longer semantic, and no longer affect the meaning of the page. This is akin to saying a page about ABC Company is also about their DBA (Registered business name, "Doing Business As") XYZ Corporation, which is poor practice. Having a page for the company, and then another for the DBA is best practice in this situation. Either the page is for the main company, or for its subsidiary LLC. Even when you're saying "ABC Company is:" then list each DBA with their respective logos, the page's meaning is the description of ABC Company, which should have the h1 or h2 carrying the ABC Company logo, with lower level headings carrying the other logos; at this point, reducing the load time is priority, and not granting meaning to the other logos. Creating searchable content for the DBAs should be relegated to h3 and lower headings.

提交回复
热议问题