首页 > 其他分享 >TreeSaver 使用教程整理——Step 4: Using a Title Figure

TreeSaver 使用教程整理——Step 4: Using a Title Figure

时间:2023-06-27 20:01:40浏览次数:47  
标签:container Figure figure title Title TreeSaver width Step fallback

请首先阅读前几篇教程,才能对本篇文章了解比较深入:

TreeSaver 使用教程整理——Step 1: Getting Started

TreeSaver 使用教程整理——Step 2: Adding Basic UI

TreeSaver 使用教程整理——Step 3: Creating Grids

我们在第二步的基础上,copy到 step4 作为我们 step4 初始的基础。

 

Step 4: Using a Title Figure

内容文件 index.html 的修改

增加文章的标题,或者把已有标题用特殊标签 figure 和CSS  title fallback括起来

<figure>
  <h2 data-sizes="title fallback">
    Chapter I. Down the Rabbit-Hole
  </h2>
</figure>

说明:

figure 是Html5的标签,用于对元素进行组合。这里我们用figure对标题进行组合,不用考虑浏览器对Html5的支持问题,TreeSaver自动处理了兼容问题。

在 figure 中,我们配置了属性: data-sizes="title fallback" ,TreeSaver 使用title fallback来确定figure的内容和位置。title 是用来放置章节的名称,fallback 表示如果 figure 无法定位时,这个呢日哦那个将放在正文区域。
Within the figure, we add the custom data-sizes attribute with two values, title and fallback. Treesaver uses these values to know where the contents of the figure can be positioned. The value title is one we made up and will use for placing the name of the chapter. However, fallback is a reserved name that indicates that this content should be placed in with the body text if the figure cannot be positioned otherwise (more on that later).

 

模板 resources.html 文件的变化

把上一步模板文件如下区域做修改

<div class="grid">
   <div class="column"></div>
</div>
<div class="grid cols-2">
  <div class="column"></div>
  <div class="column col-2"></div>
</div>
<div class="grid cols-3">
  <div class="column"></div>
  <div class="column col-2"></div>
  <div class="column col-3"></div>
</div>

修改为:

<div class="grid">
  <div class="container" data-sizes="title"></div>
  <div class="column"></div>
</div>
<div class="grid cols-2">
  <div class="container cols-2" data-sizes="title"></div>
  <div class="column"></div>
  <div class="column col-2"></div>
</div>
<div class="grid cols-3">
  <div class="container cols-3" data-sizes="title"></div>
  <div class="column"></div>
  <div class="column col-2"></div>
  <div class="column col-3"></div>
</div>

说明:

我们给每个Grid增加了一个 container  同时我们使用 data-sizes 特性,把它都设置成 title, 这样用于表示我们在Grid中figure的大小是依赖于 title的数据尺寸大小。
In this markup, we have added a container to each our grids. Using the data-sizes attribute, we have indicated that the container accepts any figure with content that has a data-size value of title.

 

样式 style.css 文件的变化

我们把上一步的样式文件的如下内容替换成后面的内容

.column {
  width: 280px;
  top: 15px;
  bottom: 15px;
  left: 10px;
}

替换成:

.column, .container {
  width: 280px;
  top: 15px;
  bottom: 15px;
  left: 10px;
}
.container.cols-2 {
  width: 600px;
}
.container.cols-3 {
  width: 920px;
}

 

说明:

container 使用跟 column 同样的样式设置,我们为何确保标题跨栏,我们设置了第二栏和第三栏的container宽度。
As a base, we use the same positioning for containers as we do columns; that way, they will line up correctly within our page grid. Since we want the titles to span across all columns, we manually set the width of our two and three-column containers.

 

演示效果:

第一页标题贯穿了整个三栏。

TreeSaver 使用教程整理——Step 4: Using a Title Figure_使用教程 

第二页恢复了没有标题的设置。

 TreeSaver 使用教程整理——Step 4: Using a Title Figure_使用教程_02

参考资料:

https://github.com/Treesaver/treesaver/wiki/Walkthrough

标签:container,Figure,figure,title,Title,TreeSaver,width,Step,fallback
From: https://blog.51cto.com/u_15588078/6565321

相关文章

  • TreeSaver 使用教程整理——Step 3: Creating Grids
    请首先阅读前几篇教程,才能对本篇文章了解比较深入:TreeSaver使用教程整理——Step1:GettingStartedTreeSaver使用教程整理——Step2:AddingBasicUI我们在第二步的基础上,copy到step3作为我们step3初始的基础。 Step3:CreatingGrids模板文件resources.html的变化在......
  • TreeSaver 使用教程整理——Step 2: Adding Basic UI
    请首先阅读前一篇教程:TreeSaver使用教程整理——Step1:GettingStartedStep2:AddingBasicUI我们上一步实现的网页有了一个最最简单的功能,这一步我们将在上一步基础上添加切换分页的按钮以及显示当前页面信息。请Copy上一步的内容,并对下面文件做如下修改: 对资源文件(resource......
  • TreeSaver 使用教程整理——Step 1: Getting Started
    TreeSaver介绍Treesaver是一个开源的JavaScript框架,用来创建杂志风格的网页布局。 为何要整理这个系列的文章下面的教程整理自:https://github.com/Treesaver/treesaver/wiki/Walkthrough,也许是这个框架目前才刚刚起步,它的文档很成问题,文档中一些链接不能下载,源代码中欠缺一......
  • springboot 通过SchedulingConfigurer实现多定时任务注册及动态修改执行周期
    Spring中定时任务有两种实现方式:1.@Scheduled(cron表达式)2.基于SchedulingConfigurer注册定时任务这两者的区别主要有1.@Scheduled不支持动态修改定时周期,只能停止服务器,修改cron表达式,再启动服务器;SchedulingConfigurer可以动态修改2.@Scheduled只能是单线程,而SchedulingConfi......
  • configure: error: udev support requested but libudev header not installed
    ./configure --host=arm-none-linux-gnueabi错误提示:configure:error:udevsupportrequestedbutlibudevheadernotinstalled解决办法 --disable-udev取消对libudev的依赖   ./configure --host=arm-none-linux-gnueabi --disable-udev make  ......
  • django 环境和安装 + job - 蓝v - django.core.exceptions.ImproperlyConfigured: SQL
    1.部署蓝鲸2.安装djangomkdir~/.virtualenvspython3-mvenv~/.virtualenvs/djangodevpython-mvenv~/.virtualenvs/djangodevsource~/.virtualenvs/djangodev/bin/activatedeactivatesource~/.virtualenvs/djangodev/bin/activatepipinstallDjangopython-c&quo......
  • TreeSaver.js 的工作流程逻辑
    Treesaver是浏览器大小尺寸敏感(size-sensitive)的,会就着当前的浏览器尺寸(browsersize),选用不同的分栏表格(grid)做排版。初始化TreeSaver.js框架的入口源代码在后面可以看到:https://github.com/Treesaver/treesaver/blob/master/src/init.js这里的代码用到了Google开发的JS库:Closur......
  • Win7环境下TreeSaver编译环境的搭配
    首先你需要先搭配出”Win7环境下TreeSaver例子环境的搭配”然后才能继续下一步编译环境。例子环境搭配后,你可以在源代码目录下执行paver命令,搭配例子测试环境,也可以执行paverdebug生成带调试注释信息的treesaver脚本,当然也可以使用paverclean删除生成的文件。这些可以......
  • 解决:Volo.Abp.AbpInitializationException: An error occurred during ConfigureServi
    问题复现说明: 问题说明:手动搭建AbpVnext框架,就搭了Web层,配置好WebModule和Program,运行就一直报:AnerroroccurredduringConfigureServicesphaseofthemoduleVolo.Abp.Data.AbpDataModule,Volo.Abp.Data解决办法:varbuilder=WebApplication.CreateBuilder(args);......
  • [ERROR] No loader is configured for ".node" files: node_modules/fsevents/fsevent
    解决方法:修改项目中./node_modules/fsevents/fsevents.js文件//修改constNative=require("./fsevents.node")//更改为constNative=window.require("./fsevents.node")......