css段落首字母下沉_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 11:51:26
原创
1528人浏览过

摘要:

  段落首字母放大是指放大段落开头的字母或者汉字,主要使用了css的first-letter伪类选择器。

单行放大:

  在第一行内放大,效果如下:

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title>    <style>        body {            background-color: #FFFFFF;            color: #595959;        }        .contain {            width: 150px;        }        .contain p {            font: 80%/1.6 Verdana, Geneva, Arial, Helvetica, sans-serif;        }        .contain p:first-letter {            font-size: 2em;            padding: 0.1em;            color: #000000;            vertical-align: middle;        }        .contain p:first-line {            color: red;        }        .contain p:first-child:first-letter {            color: red;        }        .contain p:first-child:first-line {            color: inherit;        }    </style></head><body>    <div class="contain">        <p>This is a test article. This is a test article.</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>        <p>This is a test article. This is a test article.</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>        <p>这是一个测试</p>    </div></body></html>
登录后复制

 

AutoGLM沉思
AutoGLM沉思

智谱AI推出的具备深度研究和自主执行能力的AI智能体

AutoGLM沉思 129
查看详情 AutoGLM沉思

注意:first-letter支持IE7+,first-line支持IE8+

多行放大:

  效果如下:

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title></head><body>    <style>    * {        margin:0;        padding:0;    }    body {        font-size:12px;        font-family: Tahoma, Geneva, sans-serif;        padding:200px;    }    p {        width:150px;        color:#000;        font-size:1em;        margin-bottom: 20px;    }    p:first-letter{        float: left;        font-size:2.5em;        padding-right:5px;        text-transform:uppercase;    }    p:first-line{        color:#f00;    }    </style>    <p>This is a test article. This is a test article.This is a test article. This is a test article.This is a test article. This is a test article.</p>    <p>这是一个测试。这是一个测试。这是一个测试。这是一个测试。这是一个测试。这是一个测试。这是一个测试。</p></body></html>
登录后复制

 

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号