typography

Why do <h5> and <h6> have smaller font sizes than <p> in most user agent default stylesheets?

不羁的心 提交于 2019-12-04 16:31:07
问题 The default <h5> and <h6> section headings in HTML5 have font sizes of 0.83em and 0.67em , respectively, while the default <p> font size is 1em . That means in a block of text containing <h5> , <h6> and <p> tags, these headings will be smaller than the text they head: (Default body font size above is 14px ) This seems counter-intuitive: headings are supposed to draw the eye and command the start of a section, and font size is an important visual cue. Is there a reason why the default font

Redefining “sentence” in Emacs? (single space between sentences, but ignoring abbreviations)

谁说我不能喝 提交于 2019-12-04 16:26:41
问题 I would like to be able to navigate by sentence in Emacs (M-a, M-e). Here's the problem: by default, Emacs expects that each sentence is separated by two spaces, and I'm used to just putting a single space. Of course, that setting can be turned off, to allow for sentences separated by only a single space, like so: (setq sentence-end-double-space nil) But then Emacs thinks that a sentence has ended after abbreviations with a full stop ("."), e.g. after something like "...a weird command, e.g.

Right justifying text?

天涯浪子 提交于 2019-12-04 12:49:46
I'm trying to come up with an example that experiments with different alignments as a demonstration. It's easy to left, center, right, justify, and center-left-justify text, as seen in my demonstration: You can see this example here on JSBin. How can I get right-justified text without the punctuation getting messed up? (Notice the period to the left on the last line of the center-right-justified text.) trevorp This should work in IE (only): text-align: justify; text-align-last: right; It doesn't look like there is a great cross-browser solution, but this might help: Justify the last line of a

How to handle responsive images with vertical rhythm?

风格不统一 提交于 2019-12-04 11:41:42
I'm developing an HTML page using Compass/SCSS and a vertical rhythm approach. I've set up a baseline and specified heights for paragraphs and headings in rem units. It works great and lays on a vertical rhythm grid nicely. However, I have a central image that takes 100% width of the column (I want it to be responsive and scale with the browser window). The problem is that this image breaks vertical rhythm because it's height is calculated dynamically according to the browser width and image aspect ratio and is not respecting the baseline. How do I handle this situation in order to have a

Multi-line text-overflow:ellipsis in CSS or JS, with img tags

自古美人都是妖i 提交于 2019-12-03 15:07:44
I tried using : text-overflow ellipsis feature in CSS3 (but doesn't support multi-line) several jquery plugins like dotdotdot ( http://dotdotdot.frebsite.nl/ ) jquery autoellipsis ( http://pvdspek.github.com/jquery.autoellipsis/ ). All of these tools work quite well but if content has images the calculated height for truncation with dotdotdot or jquery.autoellipsis is wrong. I was just wondering if someone has a great idea for dealing with this (maybe some server-side processing on ?), Thanks by advance :-). Use your own ellipsis positioning offsets by setting a fixed height for the multi-line

How do I calculate a String's width in Ruby?

牧云@^-^@ 提交于 2019-12-03 14:16:10
String.length will only tell me how many characters are in the String. (In fact, before Ruby 1.9, it will only tell me how many bytes, which is even less useful.) I'd really like to be able to find out how many 'en' wide a String is. For example: 'foo'.width # => 3 'moo'.width # => 3.5 # m's, w's, etc. are wide 'foi'.width # => 2.5 # i's, j's, etc. are narrow 'foo bar'.width # => 6.25 # spaces are very narrow Even better would be if I could get the first n en of a String: 'foo'[0, 2.en] # => "fo" 'filial'[0, 3.en] # => "fili" 'foo bar baz'[0, 4.5en] # => "foo b" And better still would be if I

Redefining “sentence” in Emacs? (single space between sentences, but ignoring abbreviations)

戏子无情 提交于 2019-12-03 11:27:42
I would like to be able to navigate by sentence in Emacs (M-a, M-e). Here's the problem: by default, Emacs expects that each sentence is separated by two spaces, and I'm used to just putting a single space. Of course, that setting can be turned off, to allow for sentences separated by only a single space, like so: (setq sentence-end-double-space nil) But then Emacs thinks that a sentence has ended after abbreviations with a full stop ("."), e.g. after something like "...a weird command, e.g. foo...". So rather than using the above code, is there a way to define the sentence-end variable so

Why do <h5> and <h6> have smaller font sizes than <p> in most user agent default stylesheets?

放肆的年华 提交于 2019-12-03 09:39:59
The default <h5> and <h6> section headings in HTML5 have font sizes of 0.83em and 0.67em , respectively, while the default <p> font size is 1em . That means in a block of text containing <h5> , <h6> and <p> tags, these headings will be smaller than the text they head: (Default body font size above is 14px ) This seems counter-intuitive: headings are supposed to draw the eye and command the start of a section, and font size is an important visual cue. Is there a reason why the default font sizes make these headings smaller than the text under them? I've been searching through W3C mailing lists

Ideas for converting straight quotes to curly quotes

帅比萌擦擦* 提交于 2019-12-03 05:44:33
I have a file that contains "straight" (normal, ASCII) quotes, and I'm trying to convert them to real quotation mark glyphs (“curly” quotes, U+2018 to U+201D). Since the transformation from two different quote characters into a single one has been lossy in the first place, obviously there is no way to automatically perform this conversion; nevertheless I suspect a few heuristics will cover most cases. So the plan is a script (in Emacs) that does something like the following: for each straight quote character, guess which curly quote character to use, if possible ask the user (me) to confirm,

How to create small SPACES in HTML?

一世执手 提交于 2019-12-03 04:15:36
问题 There is em dash and en dash. Is there an "en" equivalent to   ? Is there an en equivalent to pure Ascii 32 ? I want a better way to write this: 123<span class="spanen"> </span>456<span class="spanen"> </span>789 or this: 123<span class="spanen"> </span>456<span class="spanen"> </span>789 回答1: Don't use hacks that make no sense. If you wish to separate some words, I suggest you use the CSS property word-spacing: .strangeNumbers { word-spacing: 0.5em; } <span class="strangeNumbers">123 456<