首页 > 其他分享 >TreeSaver 使用教程整理——Step 3: Creating Grids

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

时间:2023-06-27 20:01:28浏览次数:42  
标签:Creating Grids column TreeSaver width grid 15px columns left

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

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

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

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

 

Step 3: Creating Grids

模板文件 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>

说明:

杂志化的排版,分栏是必需的,这时候我们就要用到Grid,每一栏填满后,就继续填充下一栏。
A Grid is like an empty page skeleton, Treesaver searches for Columns within a grid (a column is any element with the column class), and automatically fills the column with text until full. When all the columns within a grid have been filled, the page is complete.

 

样式文件的变化

把原先如下两节样式

.grid {
  width: 300px;
  border: 1px solid #ccc;
  margin: 9px;
  opacity: .25
}
.column {
  width: 280px;
  top: 5px;
  bottom: 5px;
  left: 5px;
}

修改为:

.grid {
  width: 310px;
  border: 1px solid #ccc;
  margin: 9px;
  opacity: .25;
  min-height: 30px;
}
.cols-2 {
  width: 620px;
}
.cols-3 {
  width: 940px;
}
.column {
  width: 280px;
  top: 15px;
  bottom: 15px;
  left: 10px;
}
.col-2 {
  left: 320px;
}
.col-3 {
  left: 630px;
}

说明:

我们对CSS做了如下修改:

  • 重新定义分栏,Treesaver 是通过绝对定位来控制布局的,为了页面和分栏的空白,我们设置.column 的 bottom: 15px;top: 15px; 设置.column 的left: 10px; 是为了避免重叠。
    Positioning Columns: Treesaver gives designers complete control over column sizing and placement, via absolute positioning. In the .column clause, we set top and bottom to 15px in order to give a bit of whitespace between the columns and the page border. The left property is used to horizontally position each column, otherwise the columns would overlap each other.
  • 分栏的宽度,假设我们希望每栏的宽度是 280px,则第二列的宽度应该是:(280 * 2 + 30 + 15 * 2 = 620),30 是两列间的缝隙,15是边框的距离。
    Setting Grid width: By adding the CSS class cols-2 or cols-3 to the grids, it is relatively simple to adjust the grid width in order to have space to place each column. We have calculated the width based on the number of columns, and the amount of whitespace we want around each column. For instance, the two-column grid has two columns that are 280px wide, plus a 30px gutter and 15px between the columns and the outer page border (280 * 2 + 30 + 15 * 2 = 620).

 

 

演示效果:

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

我们每页都采用了分三栏的方式。

 

参考资料:

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

标签:Creating,Grids,column,TreeSaver,width,grid,15px,columns,left
From: https://blog.51cto.com/u_15588078/6565323

相关文章

  • 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,也许是这个框架目前才刚刚起步,它的文档很成问题,文档中一些链接不能下载,源代码中欠缺一......
  • 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删除生成的文件。这些可以......
  • Error creating bean with name 'sqlSessionFactory' defined in class path resource
    项目启动报错原因分析背景:system模块一个月未重启过,今天重启报数据源问题原因:这里报错的原因是数据源配置问题解决:数据源配置在nacos中,拿该模块的nacos数据源配置与项目启动成功的模块的数据源配置进行对比,检查出不同,改为一样即可......
  • qt6.5.0使用windeployqt发布程序提示Creating qt_ar_qm... Cannot open. : 拒绝访问
    报错内容如下图这是一个软件bug,qt社区的解决办法是,使用新版本6.5.1或6.6.0 ......
  • sklearn gridsearch不能使用验证集导致的过拟合问题
    https://stackoverflow.com/questions/31948879/using-explicit-predefined-validation-set-for-grid-search-with-sklearn  或者用optuna####useoptunalibtofinetuneSVChyperparametersifmethod=='optuna':importoptuna......
  • Creating your own OpenID Connect server with ASOS: testing your authorization se
    Thispostistheeighthpartofaseriesofblogpostsentitled CreatingyourownOpenIDConnectserverwithASOS:IntroductionChoosingtherightflow(s)RegisteringthemiddlewareintheASP.NETCorepipelineCreatingyourownauthorizationproviderI......
  • GridSearchCV中的scoring
    说明scoring参数输入形式包括字符串、可调用对象或评分函数。以下是常用的评分规则示例:使用预定义的字符串指定评分规则:'accuracy':准确率(分类问题)'precision':精确率(分类问题)'recall':召回率(分类问题)'f1':F1分数(分类问题)'r2':R2分数(回归问题)'mean_squared_error':均方误差(......
  • 错问题:--谷粒商城--org.springframework.beans.factory.beancreationexception: error
    做谷粒商城使用人人开源的时候,导入nacos时出现这个问题最后发现是自己在导入时没有把这个版本改掉,最终出现问题,大概原因就是spring的版本和nacos的版本不匹配。<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent<......