css中首字母下沉

The techniques shown here are somewhat outclassed by the more complex initial-letter property, which is now recommended for drop caps; this material has left in place for research purposes.

这里显示的技术在某种程度上被更复杂的initial-letter属性所超越,现在建议将其用于首字下沉; 该材料已保留用于研究目的。

Using a decorative initial capital letter to start a paragraph is a very old technique, pre-dating the invention of movable type. Some of the most beautiful and ornate initial capitals are associated with illuminated manuscripts, largely written by clergy between the 4

th and 15 th centuries CE.

4和 15个世纪CE之间主要写的神职人员。

Initial capitals have an important editorial role to play: they indicate to the reader that a new section of text has begun. Initial caps are typically several times larger than the base font used on the page, and are featured only once per text section: in a traditional book, once per chapter; in a website, perhaps once per page. They are commonly associated with leading, opening, or first paragraphs.

首字母大写起着重要的编辑作用:它们向读者表明新的一段文字已经开始。 初始大写通常比页面上使用的基本字体大几倍,并且每个文本部分仅显示一次:在传统书籍中,每章一次; 在网站上,也许每页一次。 它们通常与开头,开头或第一段相关。

An oversized initial capital letter that shares a common baseline with the first line of text is known as a standing initial capital, standing cap, or pop cap. An initial capital letter that has several lines of text to its right is known as a dropped initial capital, or drop cap.

与第一行文字具有相同基准的超大写首字母被称为常备大写,大写大写 。 首字母大写带有多行文字的地方称为首字母大写或首字下沉

简单的站立帽 (Simple Standing Cap)

First, our code:

首先,我们的代码:

<h1>The First Phillipic</h1>
<p>Philip, after the defeat of Onomarchus, had marched toward the pass of Thermopylae, which, however, he found occupied by the Athenians, who had sent a force for the purpose of preventing his advance. Being baffled there, he directed his march into Thrace, and alarmed the Athenians for the safety of their dominions in the Chersonese.

The matching CSS:

匹配CSS:

h1 + p:first-letter {font-size: 300%;
}

Note that an initial cap is typically changed in appearance in greater ways than we have done here: color, font (a sans-serif typeface is often used) and other properties are often altered.

请注意,初始大写字母的外观更改通常比我们在此做的更大: colorfont (通常使用无衬线字体)和其他属性经常被更改。

简单的首字下沉 (Simple drop cap)

Turning the initial cap into a drop cap could not be simpler:

将最初的上限变成首字下放再简单不过了:

h1 + p:first-letter {font-size: 300%;float: left;
}

Note that any element can be floated, not just images. We would typically add margin, padding and other properties to this declaration in order to improve the appearance of the drop cap. Unfortunately, the browser will not attempt to align the baseline of the drop cap to the nearest matching text line; that will be up to us.

请注意,任何元素都可以浮动,而不仅仅是图像。 我们通常会在此声明中添加marginpadding和其他属性,以改善首字下沉的外观。 不幸的是,浏览器不会尝试将首字下沉的基线与最匹配的文本行对齐; 这将取决于我们。

基于图像的首字下沉 (Image-based drop cap)

A truly ornate standing or drop cap, like the illuminated example that led this entry, would not be text, but an image. In that case, the id and existing style would be removed, to make way for HTML code. If our image was called p.jpg, then our HTML code would be:

一个真正的华丽站立或首字下沉,就像引导该条目的发光示例一样,不是文字,而是图像。 在这种情况下,将删除id和现有样式,以便为HTML代码腾出空间。 如果我们的图像称为p.jpg ,那么我们HTML代码将是:

<p><img src="p.jpg" alt="P" style="float: left;">hilip,
after the defeat of Onomarchus, had marched toward the pass of Thermopylae, which, however, he found occupied by the Athenians…

Note that in this case the image physically replaces the first letter. Because of this it is particularly important to set the alt value of the image correctly, so that if the drop cap image did not load for any reason the paragraph text would still read correctly, with the missing image being replaced with the value of the attribute. For this reason, we would not provide a height and width for the image: unlike normal circumstances, we do not want to preserve space for the image in the eventuality that it did not load.

请注意,在这种情况下,图像会物理替换第一个字母。 因此,正确设置图像的alt值尤为重要,因此,如果由于任何原因未加载首字下沉图像,则段落文本仍将正确读取,而丢失的图像将替换为属性值。 因此,我们不会为图像提供heightwidth :与正常情况不同,我们希望在图像未加载的情况下保留图像的空间。

翻译自: https://thenewcode.com/51/Classic-Typography-Effects-in-CSS-Basic-Initial-Caps-and-Drop-Caps

css中首字母下沉

css中首字母下沉_CSS中的经典版式效果:基本首字母大写和首字下沉相关推荐

  1. css中的媒体查询_CSS中的媒体查询

    css中的媒体查询 CSS | 媒体查询 (CSS | Media Queries) Creating a web page is not an easy task as it requires lo ...

  2. css grid随页面大小_CSS中的间距知识总结,前端开发中各种间距的使用及优缺点

    本文经作者授权翻译,来源:https://ishadeed.com,作者:Ahmad Shadeed 如果两个或多个元素很接近,那么用户就会认为它们以某种方式属于彼此.当对多个设计元素进行分组时,用户 ...

  3. css中的单位换算_CSS中各种长度单位总结

    在前端开发工作过程中曾碰到这样一问题: .parent{ width:400px; height:300px; border:1px solid #ccc; } .child{ margin:10%; ...

  4. 插入脚注把脚注标注删掉_CSS中的经典版式效果:脚注

    插入脚注把脚注标注删掉 Footnotes are one of the few pieces of typography that the web would appear to have negl ...

  5. css中首字母下沉_CSS首字母大而精美的首字下沉

    css中首字母下沉 While it's long been possible to create traditional dropcaps on the web using the ::first- ...

  6. css中首字母下沉_具有“首字母”的更好CSS首字下沉

    css中首字母下沉 学习CSS:完整指南 无论您是刚刚开始使用基础知识还是想探索更高级CSS,我们都已构建了完整的指南来帮助您学习 CSS. 落帽 首字下沉是一种装饰形式,有时在一段文本的开头使用: ...

  7. css首字下沉_如何在Word 2013中创建首字下沉

    css首字下沉 A drop cap is a decorative element typically used in documents at the start of a section or ...

  8. css中设置首字下沉效果,CSS如何实现首字下沉效果?

    我们在开发 web 页面时,如果是涉及到文字段落的开发,需要对文字设置一些特殊样式以增强 web 页面美观,提升用户体验度.那么今天 w3cschool 小编来教大家 CSS 如何实现首字下沉效果. ...

  9. css入门教程 网页首字下沉,CSS制作首字下沉_CSS Inline Layout Module, initial-letter, CSS3 教程_w3cplus...

    在杂志排版中,常常能看到首字下沉的效果. 在Web的排版中,也常常能看到上图这样的效果.并且常常看到的是首段首字下沉.那么今天这篇文章咱们来聊聊如何使用CSS实现首字下沉效果. ::first-let ...

最新文章

  1. 大话软件测试与职业生涯
  2. 如何让局部变量具有全局生命期
  3. ELF 文件 动态链接 - 地址无关代码(GOT)
  4. 在HTML中嵌入PHP代码,有以下几种方法,其中错误的是( )
  5. 查看pem证书的ASN数据结构的方法
  6. tomcat 原理与使用资料
  7. excel日期跳过休息日_休息一下Excel游戏
  8. 【Linux】一步一步学Linux——stty命令(243)
  9. python经纬度转换xy坐标公式_python 经纬度和平面坐标相互转换利用米勒坐标系
  10. 检测X光图像中Covid-19
  11. 【MyBatis-Plus】CRUD 操作
  12. 利用TL-WR842N(V4)进行路由桥接搭建WDS出现的问题
  13. Excel VBA 用字典方法做先进先出法
  14. 【华为】MPLS及MPLS VPN概念
  15. Grush如何使用IBM Cloud Architecture Center中的IoT架构构建智能牙刷
  16. Ubuntu的安装教程
  17. 基于Qsys的DDR2内存驱动
  18. Unity3D 使用高通AR(一)
  19. require.content
  20. 苹果6屏幕多大_iPhone 12 Pro测试:屏幕/镜头玻璃硬度为6、依旧不耐划-苹果,iPhone 12 Pro ——快科技(驱动之家旗下媒体)-...

热门文章

  1. Windows 7 Windows 10配置共享文件夹
  2. 3 北京超算云计算平台深度学习环境配置笔记
  3. cere学习二(Solver::Options类与Problem::problem类的简单介绍)
  4. 笔记本打开计算机盘非常慢,笔记本开机慢怎么办【方法步骤】
  5. 什么是Ubuntu的使命?
  6. 温岭创新计算机网络技术有限公司,创新永无止境,服务从心开始
  7. 杰理之充电仓带通信方案【篇】
  8. 生化-离子转换单位以及一些特殊计算方法
  9. C#运行程序无法启动,因为应用程序的并行配置不正确【解决方案】
  10. 张一鸣:给面试候选人的 5 点建议