横向文字瀑布流,不错的一个东西 纯html+css

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            /*以下为设置li自动横向排列的样式*/
            #nav
            {
                /*width: 80%;*/
                margin: 0 auto;
                 /*border: 2px solid #00CED1;*/
            }
			#nav li{margin-right:5px;}
            ul,li /*这是关键,去掉ul li默认的margin padding 值*/
            {
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            ul /*这是关键*/
            {
                display: flex;
                flex-direction: row;
                flex-wrap: wrap;

            }
            li
            {
                border: 1px solid;
                width: 100px; /*每个元素的初始化宽度*/
                text-align: center;
                margin-top: 10px;
                margin-bottom: 10px;
                flex:auto;  /*这是关键*/            
            }

            /*以下为设置多栏div自动横向排列的样式*/
            .boxes /*这是关键*/
            {
                display: flex;
                flex-direction: row;
                flex-wrap: wrap;
            } 
            .box 
            {
                border: 1px solid #999; 
                border-radius: 10px; 
                flex: auto;/*这是关键*/
                margin: 5px; 
                padding: 10px; 
                width: 100px;/*每个元素的初始化宽度,这是关键*/
            }           
            .box1
            {
                flex:2;/*设置匹配元素所占宽度为平均值的2倍,如果不设置,所有栏等宽*/
            }
        </style>
    </head>
    <body>
        <div id="nav">
            <ul>
                <li>AAAAAAAA</li>
                <li>BBBBBB</li>
                <li>CCCSC</li>
                <li>DDDD</li>
                <li>EEEE</li>
                <li>FFFF</li>
                <li>BBB</li>
                <li>CCCC</li>
                <li>DDDD</li>
                <li>EEEE</li>
                <li>FFFSSSSSSSSSSSSSF</li>
                <li>BBBB</li>
                <li>CCCC</li>
                <li>DDDD</li>
                <li>EEESSSSSSE</li>
                <li>FFFF</li>
                <li>BBBB</li>
                <li>CCCC</li>
                <li>DDDDSSSSS</li>
                <li>EEEE</li>
                <li>FFFF</li>
                <li>CCSSSSSCC</li>
   
            </ul>
        </div>
        <div class="boxes">
            <div class="box box1">
                <h2>Don't excessively interpret South China Sea drill</h2>
                <p>"Holding sea drills is a common practice for navies with various countries. The annual, regular drill by the Chinese navy aims to test the troops' real combat abilities, boost their maneuverability, search and rescue power and the abilities to fulfil diversified military missions," said spokesperson Liang Yang on Saturday.  </p> 
            </div>
            <div class="box box2"> 
                <h2>Putin, Blatter voice mutual support at World Cup</h2> 
                <p>FIFA's President Sepp Blatter shakes hands with Russia's President Vladimir Putin (R) during the preliminary draw for the 2018 FIFA World Cup at Konstantin Palace in St. Petersburg, Russia July 25, 2015.</p>
            </div>
            <div class="box box3">
                <h2>Passenger detained for creating chaos on flight</h2>
                <p>A passenger attempted to damage facilities on Shenzhen Airlines flight ZH 9648, which departed from Taizhou City of east China's Zhejiang Province, when it was landing in Guangzhou Baiyun International Airport at around 1 a.m. on Sunday, according to the airport. </p> 
            </div>
            <div class="box box1">
                <h2>Don't excessively interpret South China Sea drill</h2>
                <p>"Holding sea drills is a common practice for navies with various countries. The annual, regular drill by the Chinese navy aims to test the troops' real combat abilities, boost their maneuverability, search and rescue power and the abilities to fulfil diversified military missions," said spokesperson Liang Yang on Saturday.  </p> 
            </div>
            <div class="box box2"> 
                <h2>Putin, Blatter voice mutual support at World Cup</h2> 
                <p>FIFA's President Sepp Blatter shakes hands with Russia's President Vladimir Putin (R) during the preliminary draw for the 2018 FIFA World Cup at Konstantin Palace in St. Petersburg, Russia July 25, 2015.</p>
            </div>
           
        </div>
    </body>
</html>

效果图如下

HTMLCSS通常用于创建网页布局和样式,而将网页切图并生成PDF文件通常涉及到将这些网页转换为可打印的格式。如果需要将网页内容以横向的方式展示在PDF中,可以遵循以下步骤: 1. 使用HTMLCSS创建内容:首先,使用HTML编写页面结构,并用CSS进行样式设计。对于横向展示,你需要确保页面的布局是针对横向阅读和打印设计的。 2. 设置打印样式:为了确保PDF输出符合要求,你需要使用CSS的@media print规则来定义特定于打印的样式。例如,可以设置边距(margin)、页眉(header)、页脚(footer)、分页符(page-break-before、page-break-after等)和背景图片的打印行为。 3. 使用JavaScript或后端生成PDF:有许多JavaScript库(如jsPDF、PDFMake等)可以用来将网页内容转换为PDF格式。这些库通常提供了丰富的API来帮助你控制PDF文件的生成,包括设置页面大小、方向、边距等。如果使用后端技术(如Node.js),也可以利用相关库(如pdfkit)来生成PDF。 4. 控制页面方向:在定义打印样式时,可以通过设置`@page`规则的`size`属性来控制页面的方向。例如,`@page { size: A4 landscape; }`将页面设置为横向的A4纸张。 5. 调整布局以适应横向:在横向布局中,需要重新考虑元素的排列和大小,确保内容在横向上不会显得过于拥挤或稀疏,同时考虑到分页的位置,避免内容被不恰当地分割。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值