Better HN
topnewbestaskshowjobs
Log inSign up

csswizardry

913 karma · joined Apr 26, 2011 (15y ago) · 156 submissions

* Consultant Web Performance Engineer * Google Developer Expert * csswizardry.com * @csswizardry

![](https://csswizardry.com/img/css/masthead-small.jpg_ — csswizardry.at.hn

--- meet.hn/city/gb-Leeds

Socials: - csswizardry.at.hn - bsky.app/profile/csswizardry.com - github.com/csswizardry - instagram.com/csswizardry - linkedin.com/in/csswizardry - csswizardry.com - x.com/csswizardry ---

Submissions

comment 14y ago · link · parent

Thanks for the great comment! We’re really excited about faavorite and we’re thrilled to have you on board :D

H

comment 14y ago · link · parent

Sure thing, we can grab all of those (unless any were authored by a protected user).

EDIT: If you have a particularly large amount of favorites, faavorite will put you on a drip-feed import where we just grab them 200 at a time. This means you can still look around the app (or go make a coffee, or go to bed, or anything) and we’ll just grab them for you until we get all of them.

comment 14y ago · link · parent

We’re English so it’s hard to balance the two; we used ‘favorite’ as that’s what they’re called on Twitter but proper English has crept in in places. We’ll probably move over to all American–English at some point.

Cheers! H

comment 14y ago · link · parent

Also guys—anyone reading this who’s signed up—if you have any non-tech Twitter friends you might want to invite that’d be awesome! A quick glance over the site should tell you that the majority of users so far are web-dev types and we’d really like to diversify sooner rather than later!

Cheers, Harry

comment 14y ago · link · parent

Thanks! That’s a great question, we need to ponder that because faavorites do take up a lot of space because of all the other data they carry. Perhaps a toggle between all open and all closed…?

comment 14y ago · link · parent

Thank you!

> a little Marketing brushup and you'll go a long way

This is where we’re struggling at the moment; we’re just a couple of devs on a hobbyist app right now. The next ‘sprint’ we’re hoping to dedicate to marketing and ideas and the like :)

127.

Show HN: We made an app for managing your Twitter favorites(faavorite.com ↗)

24 points · by csswizardry · 14y ago · 16 comments

comment 14y ago · link · parent

If you change any code it will show up in a diff, whether that be vendor prefixed or not. A vendor prefix changing is just the same as a padding value changing; if code needs to change then change it and you will fully expect to see it show up in a diff.

Single line CSS’ problem is that a diff of it can be a little misleading.

comment 14y ago · link · parent

I do agree, I think the wording was a little unclear. By and large these are better practices than we’re used to, but the title (and README) did say these were best practices compiled for me and Sky; not everyone will agree with them but they suit Sky down to the ground.

130.

My CSS guidelines didn’t sit too well with some… here’s a rebuttal(csswizardry.com ↗)

11 points · by csswizardry · 14y ago · 3 comments

comment 14y ago · link · parent

I wrote a rebuttal

http://csswizardry.com/2012/03/hacker-news-rebuttal/

comment 14y ago · link · parent

I’ve honestly never heard of that being advocated; I’d drop that ASAP if I were you. If you want to ensure there is no page jump as images load then simply give the images width and height attributes :)

H

comment 14y ago · link · parent

Points 2, 3 and 4 are irrelevant here. Do not use IDs in CSS. Use them in markup and JS and tests, sure, just not in CSS.

Point 1: The speed difference between a class and an ID is so, so slight that it's almost non-existent. The specificity difference between a class and an ID is massive.

comment 14y ago · link · parent

> Then it's possibly appropriate.

It's definitely appropriate.

> This again makes presumptions about what kind of site you're building.

It doesn't matter whether you're building Facebook or the site for the window cleaner two doors down the road; you never want issues with maintenance, ever. Make sure you can move a person's wall post to a new location without issue, make sure Bob the window-cleaner can move a testimonial from the footer to the sidebar without issue. Size of project is wholly irrelevant.

> Specificity is an important part of the cascade.

It is, and an ID is the quickest way to f#&k with it. As is qualifying your selectors. You're tying yourself to commitments that you might not want to keep.

The things you are arguing against are the most fundamental in helping build maintainable websites.

comment 14y ago · link · parent

I see your point. This started off as a personal/close-knit reference for me and my teams’ best practices. Then I thought I might as well share it, even if only one other person finds it useful then that’s better than keeping it to myself. I packaged it with caveats and disclaimers and you can take the advice or leave it.

A document was created for a small audience, sharing it was secondary, and an afterthought. It is not up to me to decide who follows them and who doesn’t; I merely made them public and people have the ability to pick, choose or even ignore at will.

comment 14y ago · link · parent

Catch all response:

This document is a personal one, and for use at my place of work. I decided to share it in the hope that it might be useful to others but if you disagree with anything please remember; this is a document for me and Sky. You do not have to follow the advice given, nor do I provide any guarantee. — https://github.com/csswizardry/CSS-Guidelines/blob/master/RE...

> Nope.

Fair enough.

> Nope.

Fair enough.

> If you're Facebook, and you have a deep and wide site architecture…

We’re not Facebook, but we are big.

> Nope. Again, grid systems are something that should be used on a case-by-case basis, according to the nature of the site you're building.

Okay, as mentioned this is doc used largely at my place of work where we do use a grid system. For places that don’t use one then this basically means ‘don’t apply dimensions to components; leave structure to parents and wrappers’. Hard coding dimensions on components should be avoided at all costs.

> Nope. What you're arguing against is a rule that has a high degree of specificity.

I’m not. Heavily location selectors hinder flexibility; components should not rely too heavily on where they live, they should be movable as easily as possible. Shorter, less location-dependent selectors aid this.

> Don't outright ban IDs just because you're not careful enough to write clean CSS.

I believe I’ve got my CSS nailed, thanks. IDs will only ever hinder a CSS developer; they offer zero benefit (where CSS is concerned) over a class, thus why would you ever bother using them? If all they can do is harm then just cut them out; even the most careful developers can get tripped up by the overly specific nature of IDs.

> Hahahahahahahahahhaa.

I’ve just finished the rebuild a massive front-end, the project as a whole took over a year. Number of IE stylesheets: 0. It can be done.

comment 14y ago · link · parent

Because `.nav li a{}` is overly specific; that’s my whole point.

EDIT Hold on, I think I get you… My example was an example of someone writing something incorrectly. An example of it being written correctly would indeed be:

    .nav{
        li{}
        a{}
    }

comment 14y ago · link · parent

For me it is purely habit. I think: to each their own, just aim for consistency :)

comment 14y ago · link · parent

> that made my teeth itch

Fair enough; any reason as to why?

> not all vendor css3 definitions have the same structure, so this can't be a standard

Well if it can’t be done then it can’t be done…

comment 14y ago · link · parent

Thanks for the comment, I’m glad you like it :) The shorthand one is a really interesting one; it takes while to kick the habit and be purposely more verbose, but you soon get tired of undoing previously accidentally-set styles.

> Do you find indenting descendant selectors helpful?

Oftentimes yes; it can give a new developer more of a clue of the markup structure that a previous developer intended to be used. I can see at a glance that `x` needs to be in `y` but `a` needs to be a sibling of `b`. Of course you could just glean that yourself by looking at and reading all the selectors individually, but it’s nice to get an idea of structure at a glance.

> For your comments, do you adhere to CSSDoc or any particular convention?

Nothing official; I have my own habits but no documented standard. I like the look of http://warpspire.com/posts/kss/ though :)

H

comment 14y ago · link · parent

> Not if .nav li a{} and .nav a{} are specifically meant to be differing nests.

But in the example they aren’t differing nests; if you change your example then obviously it isn’t correct any more.

comment 14y ago · link · parent

> Please don't label things that can be discussed as 'best practices'.

This is valid point, however In the README there is the line ‘This document is a personal one, and for use at my place of work […] this is a document for me and Sky. You do not have to follow the advice given, nor do I provide any guarantee.’

In the context of our team I can afford to make more sweeping statements because I have the ability to discuss and expand on the caveats. Perhaps this document becomes less useful in places without that context.

> e.g this text is 12px, because it looks nice

This is not an example of a magic number, this is a design decision that was made regardless of code. Perhaps I need to me more clear on what a magic number is, but by that I mean anything that has no reason for being.

Cheers for the feedback, I might look at rewording some bits for clarity :)

H

comment 14y ago · link · parent

No reason other than that is what I started off with and I’d rather keep things consistent. Had I started off with underscores then I’d be asking the team to stick with that.

I guess that section is more about ‘keep everything the same’ rather than ‘we must specifically use hyphens’ :)

Cheers, H

144.

Show HN: I decided to document and share my high-level CSS best practices(github.com ↗)

223 points · by csswizardry · 14y ago · 86 comments

comment 14y ago · link · parent

> but I feel that classes give more meaning to an element

But they don't. Classes (and IDs) have nothing at all to do with semantics or meaning.

You can use whichever notation you wish (.big, .small, .alpha, .giga etc), I state as much at the end of the article, just remember that classes do not add meaning to (or subtract meaning from) an element :)

H

comment 14y ago · link · parent

Classes are neither semantic or insemantic, merely sensible or insensible.

Realising that classes aren't subject to the same semantics as elements is a massive breakthrough for a front-end developer to make IMO.

These classes aren't 'semantic' because no classes are; semantics in the front-end development sense is when something (i.e. a machine) can glean meaning from something. No machines (browsers, search bots, assistive technologies etc) actually interpret classes, they merely match them. The only thing that gleans meaning from a class is a human, so you should write classes for people.

Thus, in a roundabout way, no classes are semantic, so we need to stop worrying about that.

Cheers for the comment!

147.

Pragmatic, practical font sizing in CSS(csswizardry.com ↗)

19 points · by csswizardry · 14y ago · 5 comments

148.

Measuring and sizing UIs, 2011-style(csswizardry.com ↗)

1 points · by csswizardry · 14y ago · discuss

comment 14y ago · link · parent

Ah cool, my good buddy Nick made this!

150.

Pure CSS *fluid* content slider(dl.dropbox.com ↗)

2 points · by csswizardry · 15y ago · discuss

123456