7 ms·
Em Baseline Generator
- exceptione 14y agoThe letters are hanging in the air, i think a good demonstration would show the baseline of the letters to coincide with the line pattern! http://upload.wikimedia.org/wikipedia/commons/3/39/Typography_Line_Terms.svg http://upload.wikimedia.org/wikipedia/commons/3/39/Typograph...
- joshnh 14y agoHi, creator here. Unfortunately that's not how CSS works. See here for more information: http://joshnh.com/2012/10/12/how-does-line-height-actually-work/ http://joshnh.com/2012/10/12/how-does-line-height-actually-w...
- exceptione 14y agoI read your article. But i am still wondering why you cant shift the pattern so that the lines really line up with the baseline. You can influence the leading via margin or padding and the line-height property, right?
- joshnh 14y agoAbsolutely, you can hack it on a very individual basis, but this introduces some major problems. For instance, browsers and operating systems all render fonts differently, and as the web is fluid by nature, simply having a sentence break to the next line can be an issue. Also, it can be incredibly different based on the typefaces you are using.
- exceptione 14y agothen i still don't get it. When a simple line break would break a horizontal baseline-aligned grid, wouldn't it break a horizontal baseline-plus-some-space-aligned grid? Although the css prop. "line-heigt" is not implemented in a convenient way, it is still deterministic as I understand from the quoted article: "This is determined by working out the difference between the line-height and the font-size, dividing by 2, and then placing the calculated amount of space above and below each line of text."
- joshnh 14y agoOnly if you are using line-height to hack together a print baseline on the web. Let me put it this way, if there was a semi-reasonable solution, I'm sure you would have heard about it.
- cooop 14y ago> The letters are hanging in the air, i think a good demonstration would show the baseline of the letters to coincide with the line pattern! Why? Like OP has demonstrated, this isn't how CSS works. To do so because this is how things are done in print is backwards. You could argue letters sitting on their baseline feels nicer to you, though I'd argue this was form over function. Nice work, OP.
- grey-area 14y agoLike OP has demonstrated, this isn't how CSS works. To do so because this is how things are done in print is backwards. You could argue letters sitting on their baseline feels nicer to you, though I'd argue this was form over function. This isn't a baseline - a typographic baseline aligns with the baseline of the letters because this is actually useful in design for example in order to line up pictures with the baseline. No-one said this 'feels nicer' it looks bad when pictures almost align but not quite with text, or when two columns of text don't align (check out CSS columns[1] for more examples of this lack of attention to typography in the spec messing up layout). If you call this a baseline, you'd probably steal sheep! [2] CSS was created without much reference to traditional typography, and thus makes it hard to do good designs with grids, baselines etc. This is a failing in the CSS spec, not something to be celebrated as the new ideal. There are entire frameworks out there trying to address all the failings of CSS when doing proper design (Bootstrap, Foundation etc all feature grids, something CSS is lacking). It's a shame the creators of CSS didn't consider more deeply the centuries of thought people have put into placing type on a page (or vellum, or a stone wall, or a poster, or a screen, or a phone, many of these rules apply to any medium in varying degrees). If they had we'd have avoided a lot of the hoops people have to jump through just to produce pleasing designs. I'm not clear why this grid is useful for web design, except perhaps as an illustration of another facet of CSS which is broken by design? Why would you want to align elements with the bottom of the line box as defined by CSS (which is usually invisible)? [1] http://zomigi.com/blog/deal-breaker-problems-with-css3-multi-columns/ http://zomigi.com/blog/deal-breaker-problems-with-css3-multi... [2] http://www.webtypography.net/Rhythm_and_Proportion/Horizontal_Motion/2.1.7/ http://www.webtypography.net/Rhythm_and_Proportion/Horizonta...
- 14y ago
- ksherlock 14y agoYou could check out http://www.baselinecss.com http://www.baselinecss.com which uses a lineheight + top to push text down.
- pasiaj 14y agoExcellent! You should also checkout http://www.gridlover.net/ http://www.gridlover.net/
- Kiro 14y agoWhy do I need to use em? I thought browsers handled things like zooming on their own nowadays. What's wrong with px?
- arianvanp 14y agoWith em you define a base font-size in px. And then you express multiples of the base in em, instead of multiplying manually
- daigoba66 14y agoHow is it different, better/worse, than expressing font sizes as percentage?
- joe5150 14y agoEms and percents behave differently when a user changes the browser's font size setting (which I think you only see in IE now), but are otherwise the same. Other than that the only advantage is in the fact that ems are a standard convention for designers and typographers, who are used to expressing measurements as a proportion of the text size, and "1 em" is just a more concise representation of that measurement than "100% of the point size of the font in use".
- joshnh 14y agoEms are more versatile. When increasing the size of all fonts at a particular breakpoint for instance. Instead of having to adjust each font-size property individually you can simply change the font-size of the root element.
- binarymax 14y agoThis is very nice, but wondering if the em can be rounded a bit? I'm not sure there's much difference between 1.5238095238095237em; and 1.524em;
- namuol 14y agoWe require more Lorem.
- GhotiFish 14y agoMight I recommend lorem ipsum to paragraph. paragraph paragraph. paragraph. ? It gives a more meaningful look at how a paragraph would actually look.
- eoconnell 14y agoI prefer using rem over em. Em values multiply when nested where rem values do not.
- joshnh 14y agoI plan on having an option to output rem with px fallback code.
- lucisferre 14y agoWould be nice to have classes for the 6 font sizes as well. I typically don't use H tags to control font size.
- envex 14y agoSeems easy enough to just edit the generated code to add your classes. Also, shouldn't you be using headlines when headlines should be used instead of classes? Semantics and everything.
- lucisferre 14y agoSure but semantic importance doesn't necessarily need to have anything to do with font sizing. It's also easy enough to generate the code myself, the point of a generator would arguably have been to do that for me.
- GhotiFish 14y agoAnother thing: When your reactive layout switches to a single column. Float the sliders. so they're always visible. Actually floating the sliders so they're always visible is probably a good idea regardless of layout.
- joshnh 14y agoWhat browser/OS? I can't replicate the issue you seem to be having.