Hacker News new | past | comments | ask | show | jobs | submit login

    I’ve found a pretty simple starting point for
    testing the bones of a website by using the
    following single line of CSS:
    
       * {
           border: 2px dotted black;
       }
Another nice way to find obsolete elements is to simply type this in the console:

    $$('*:only-child')
Elements with only one child usually can be optimized away. For example here on HN, it shows that every <code> element is wrapped in a <pre> element. I would think the same could be achieved by just setting the right styles on the <code> element.



That wouldn't necessarily be correct. <pre> is for preformatted. <code> is for code. The first tells the browser it's preformatted (which, to your point, is style related); the second tells you and the browser why that is -- it's code.

A poem might be a good example of something else you'd want to preformat.

Also, <pre> is a block element, while <code> is not.

The real issue is that there's something to be said about suggesting to write <pre class="code"> and <pre class="poem"> etc., or for that matter <pre type="whatever"> or simply <div class="whatever">. The real wtf here is that <code> has a special status in html while <poem> and other things that might want to be preformatted don't have their own tag. And that <pre> merely is a special type of <div> with some styling (which suits code just fine, but not poems) attached to it.




Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: