小编mor*_*usg的帖子

HTML中的H1-H6字体大小

在HTML(以及一般的排版,我想)中,似乎有一些H1-H6元素的定义大小.

即,如果基线字体大小为16px(或100%),则h1(w/c)应为2.25em(36px).H2(w/c)应为1.5em(24px).等等.这些变量来自哪里?H1 = 36px,H2 = 24px,H3 = 21px,H4 = 18px,H5 = 16px,H6 = 14px,即.(或者,如果你愿意,H1 = 2em,H2 = 1.5em,H3 = 1.17em等,这一点不是数字本身,而是它们之间的关系)

它们有一些数学公式吗?它与黄金比例或斐波那契有关吗?我一直无法找到相关信息.

编辑:更具体地说,模式是什么; 为什么从36到24到21,或从36开始(或者,如果你喜欢,从2em到1.5em到1.17em等)?

哦,我忘了说明我想出原始数字的地方,他们就是从这里来的

html typography

51
推荐指数
6
解决办法
8万
查看次数

如何.catch Promise.reject

我有一个辅助函数用于fetchCouchDB,结尾为:

...
return fetch(...)
  .then(resp => resp.ok ? resp.json() : Promise.reject(resp))
  .then(json => json.error ? Promise.reject(json) : json)
Run Code Online (Sandbox Code Playgroud)

当我在其他地方使用它时,我的印象是我可以.catch明确拒绝:

  above_function(its_options)
    .then(do_something)
    .catch(err => do_something_with_the_json_error_rejection_or_resp_not_ok_rejection_or_the_above(err))
Run Code Online (Sandbox Code Playgroud)

但是,唉,我似乎无法控制拒绝.我之后的具体错误是HTTP 401响应.

是什么赋予了?

(请注意,returns中有隐含的ES6 .then)

javascript es6-promise

21
推荐指数
3
解决办法
3万
查看次数

点击标题可排序表格

是否可以在TeX中创建一个表并编译成PDF,这将具有其列标题,单击它们将按该列对(数字)表内容进行排序?

我知道你可以在PDF中以某种方式使用Javascript,这可能会允许这样的东西.

有没有人做过这样的事情?

javascript pdf tabular

8
推荐指数
1
解决办法
1308
查看次数

将纯文本列表转换为html

我有一个这样的纯文本列表:

I am the first top-level list item
  I am his son
  Me too
Second one here
  His son
  His daughter
    I am the son of the one above
    Me too because of the indentation
  Another one

我想把它变成:

<ul>
  <li>I am the first top-level list-item
    <ul>
      <li>I am his son</li>
      <li>Me too</li>
    </ul>
  </li>
  <li>Second one here
    <ul>
      <li>His son</li>
      <li>His daughter
        <ul>
          <li>I am the son of the one above</li>
          <li>Me too because of the indentation</li>
        </ul>
      </li>
      <li>Another …
Run Code Online (Sandbox Code Playgroud)

html ruby parsing

3
推荐指数
1
解决办法
1180
查看次数

尺寸的类型定义

如何定义尺寸类型?

你能用另一种类型定义一种类型吗?(即一英寸是72个PostScript点).
为尺寸单位制作新类型是否有意义?

我见过其他类型的库,但我感兴趣的尺寸是:缩放点(最小,可能是Int?),点(65536缩放点),异食癖(12点)等.

haskell

1
推荐指数
1
解决办法
182
查看次数

标签 统计

html ×2

javascript ×2

es6-promise ×1

haskell ×1

parsing ×1

pdf ×1

ruby ×1

tabular ×1

typography ×1