css 网格布局_CSS网格布局-创建复杂的网格

css 网格布局

With the Blink and Webkit implementation moving on at great pace, a number of updates to the specification, and Mozilla announcing an Intent to implement CSS Grid Layout, 2015 really is shaping up to be a good year for Grid. As part of my exploration I’ve been looking for good examples of grids in use to rebuild, to see how Grid works for these uses.

随着Blink和Webkit实现的快速发展,对该规范的大量更新以及Mozilla宣布实现 CSS Grid Layout的意图,对于 Grid来说,2015年确实是好年。 作为探索的一部分,我一直在寻找用于重建的网格的良好示例,以了解Grid如何用于这些用途。

In this post I’ve assumed a bit of Grid knowledge, so if you need an introduction to the CSS Grid Layout Module then take a look at my Grid by Example site.

在这篇文章中,我假设了一些Grid知识,因此,如果您需要CSS CSS Grid Layout Module的简介,请查看我的Grid by Example网站。

I’ve been looking at the Susy Grid recently. Susy claims to be a semantic grid system – as in it doesn’t require that you pepper your markup with classes to control the grid. It’s also “grids on demand”, you create the grids you need in your Sass, and Susy creates the CSS for you. Crucially, Susy deals with the often complex mathematics needed to use grid structures with the layout tools we currently have.

我最近一直在看Susy Grid 。 Susy声称是一个语义网格系统–因为它不需要您在标记中添加类来控制网格。 它也是“按需网格”,您在Sass中创建所需的网格,而Susy为您创建CSS 。 至关重要的是,Susy处理了当前使用的布局工具来使用网格结构所需的通常很复杂的数学。

My experiments have left me impressed. The current state of CSS layout means that unless you like to spend a lot of time doing calculations something like Susy is really useful. The output CSS is pretty much what I’d come up with myself, which to me is the acid test for tool use, “does it write what I would but faster?”

我的实验给我留下了深刻的印象。 CSS布局的当前状态意味着,除非您愿意花费大量时间进行计算,否则类似Susy的东​​西将非常有用。 输出的CSS几乎就是我自己想得到的,对我来说这是对工具使用的严格测试, “它写得比我想的还要快吗?”

Back to CSS Grid Layout. It should remove the need for preprocessor based solutions for the maths at least, as with Grid Layout you don’t need to do complex calculations to position elements. Let’s test that out.

返回CSS网格布局。 至少应该消除对基于预处理器的数学解决方案的需求,因为使用网格布局,您无需进行复杂的计算即可定位元素。 让我们测试一下。

I found this post about Susy. The author takes a relatively complex grid and uses Susy to lay it out. It’s a good example of what Susy can do, so can we achieve this with the Grid Layout Module?

我发现了有关Susy的帖子 。 作者采用了一个相对复杂的网格,并使用Susy对其进行布局。 这是Susy可以做什么的一个很好的例子,那么我们可以使用Grid Layout Module实现吗?

HTML和样式CSS (The HTML and styling CSS)

I took the HTML for the Grid and the styling for the coloured boxes directly from the article, and just added a bit of text styling for the headings. Without any layout applied it looks like this.

我直接从文章中获取了Grid的HTML和彩色框的样式,并为标题添加了一些文本样式。 没有应用任何布局,它看起来像这样。

Layout with no Grid

We need to set up our 10 column grid using the div with a class of container.

我们需要使用带有一类容器的div来设置10列网格。

.container {
  width: 90%;
  margin: 0 auto 0 auto;
  display: grid;
  grid-template-columns:  (col ) 4.25fr repeat(9, (gutter) 1fr (col) 4.25fr ) (gutter);
  grid-template-rows: auto repeat(5, 100px);
}.container {
  width: 90%;
  margin: 0 auto 0 auto;
  display: grid;
  grid-template-columns:  (col ) 4.25fr repeat(9, (gutter) 1fr (col) 4.25fr ) (gutter);
  grid-template-rows: auto repeat(5, 100px);
} 

The value of the grid-template-columns property gives me a line with a name of col, with a grid track of 4.25 fraction units. I then repeat a pattern of a line named gutter, then a 1 fraction unit gutter track and the col line and track nine times. I finish off with a line named gutter.

grid-template-columns属性的值给我一行名称为col的网格,网格轨迹为4.25分数单位。 然后,我重复一个模式,命名为装订线,然后重复1个小数单位装订线轨迹以及col线和轨迹9次。 我以一条名为装订线的线结束。

For the rows I have created a single row with a height of auto to place the header in and then a repeating pattern of five 100 pixels rows.

对于这些行,我创建了一行高度为auto的行,以将标题放置在其中,然后重复了五行100像素行的模式。

I don’t need to give the rows a fixed height but it makes the example a little clearer.

我不需要将行设置为固定的高度,但这会使示例更加清晰。

I’m using named lines and line-based placement for this complex grid, and it really is just a case of popping each block onto the grid, pretty straightforward.

我正在为这个复杂的网格使用命名线和基于行的放置 ,这实际上只是将每个块弹出到网格的一种情况,非常简单。

嵌套网格 (Nested Grids)

In the example we have some nested elements. The div with the class ag2 contains ag4 to ag7. The div with the class ag7 is then a wrapper for ag8 to 10.

在示例中,我们有一些嵌套元素。 类别为ag2的div包含ag4至ag7。 然后,类ag7的div是ag8到10的包装器。

We need to make each of these nested grids a grid too. Once they become a grid we have to declare columns and rows and position their children on the new Grid, not the Grid declared on the outer.

我们也需要使每个嵌套的网格都成为一个网格。 一旦它们成为网格,我们就必须声明列和行并将其子级放置在新Grid上,而不是在外部声明的Grid上。

So on ag2 I first position ag2 itself, then make it a grid and declare the columns and rows.

因此,在ag2上,我首先将ag2本身定位,然后使其成为网格并声明列和行。

I’m using the same fraction units here as for the outer but as these are fraction units they are not the same width as the outer as they take their percentage width from their grid container.

我在这里使用与外部相同的分数单位,但是由于这些是分数单位,因此它们与外部的宽度不同,因为它们从其网格容器中获取其百分比宽度。

This could be solved by the proposed subgrid keyword. This is currently marked as “at risk” in the editor’s draft of the Level 1 spec and may get punted to Level 2 due to the complexity of implementation. It’s therefore not part of the Blink implementation. If we had subgrid we would be able to declare ag2 as a subgrid.

这可以通过建议的subgrid关键字解决。 当前,在级别1规范的编辑草案中,这被标记为“有风险”,由于实现的复杂性,可能会被打到级别2。 因此,它不是Blink实现的一部分。 如果我们有子网格,我们将能够将ag2声明为子网格。

.ag2 {
  grid-column: col 3 / span gutter 6;
  grid-row: 2 / span 5;
  display: grid;
  grid: subgrid;
}.ag2 {
  grid-column: col 3 / span gutter 6;
  grid-row: 2 / span 5;
  display: grid;
  grid: subgrid;
} 

It would then inherit the grid from the parent, ensuring that elements maintained that strict grid.

然后它将从父级继承网格,确保元素保持该严格的网格。

You can see the problem clearly once we have positioned the nested ag7 in the completed example below. The much smaller container meaning our gutter looks far too wide in proportion.

在下面完成的示例中将嵌套的ag7定位后,您可以清楚地看到问题。 较小的容器意味着我们的装订线比例看起来太宽。

There are ways round this, using absolute units for example for gutters, however I’d definitely like to see the implementation of subgrid, it would make using grids far more natural and simple for authors. Although like many things making something simple takes a lot of work!

有多种方法可以解决此问题,例如使用绝对单位作为装订线,但是我绝对希望看到subgrid的实现,这将使作者使用网格更加自然和简单。 尽管像许多事情一样,使某些事情变得简单也需要大量工作!

完成的例子 (The completed example)

Other than the subgrid issue, creating this grid just works. We end up with a layout that looks like this.

除了子网格问题之外,创建此网格也可以。 我们最终得到一个看起来像这样的布局。

Completed Layout

You can see the worked example here, using Chrome with the experimental web platform features flag enabled.

您可以在此处使用启用了实验性网络平台功能标志的Chrome浏览器查看工作示例 。

There is no complex maths to do, working out your position on the grid can be a little tricky but that is something good tooling could really help with. I would have thought it possible to create a browser plugin, or just some JavaScript to use in development that could overlay a grid with line numbering based on what was declared in the column and rows definition. The important thing is that this is all native CSS, with no reliance on preprocessors, and with no need for clearing, or the layout hacks we currently have to use.

没有复杂的数学可做,要确定自己在网格上的位置可能会有些棘手,但这是好的工具真正可以帮助的。 我本以为可以创建一个浏览器插件,也可以创建一些JavaScript以用于开发中,这些JavaScript可以基于列和行定义中声明的内容用行号覆盖网格。 重要的是,这全部是本机CSS ,无需依赖预处理程序,也无需清除,也无需使用当前需要使用的布局技巧。

It’s worth noting that I fixed the height of the rows to match the original example. With Grid it’s trivial to have full height columns. For example if I want those sidebars to be full height, I just set them to span 5 rows of the grid.

值得注意的是,我固定了行的高度以匹配原始示例。 使用Grid时,拥有全高列很简单。 例如,如果我希望这些侧边栏为全高,则只需将它们设置为跨越网格的5行即可。

This is not so easy to do with existing layout methods.

使用现有的布局方法并非易事。

Layout with full height columns

If you want to know more and see my other examples check out Grid by Example. I also spoke on this subject for CSS Conf EU last year, and that talk introduces the basic Grid concepts.

如果您想了解更多并看到我的其他示例,请查看Grid by Example 。 去年,我在CSS Conf EU上也谈到了这一主题,该演讲介绍了基本的Grid概念。

I’ll be presenting on Grid Layout at various conferences this year with an updated talk – coming up is Fluent, and An Event Apart Boston. I’m also leading a workshop on CSS Layout Modules for Future Insights Live in Las Vegas.

我将在今年的各种会议上针对Grid Layout进行演讲,并进行更新后的演讲–即将是Fluent和一个Event Apart Boston 。 我还领导了一个关于在拉斯维加斯举行的Future Future Insights CSS布局模块的研讨会。

翻译自: https://rachelandrew.co.uk/archives/2015/02/04/css-grid-layout-creating-complex-grids/

css 网格布局

掌握CSS网格布局:创建复杂设计的简易之道 本文深入探讨了CSS网格布局的强大功能,通过具体示例展示了如何使用grid工具轻松构建复杂布局。从基础的行与列的排列到更高级的网格线定位,作者揭示了CSS网格布局的灵活性和高效性。此外,还介绍了如何利用Tailwind CSS实用类来设计一个完整的文章布局,包括排版、颜色、图片和交互性。 阅读详情

相关推荐

CSS网格布局与变换的深入理解

本文深入探讨了CSS中的网格布局技术,包括隐式与显式网格的概念、网格与弹性盒模型的区别以及如何通过CSS变换增强页面动态性。详细解析了如何使用grid-auto-flow和transform属性来控制元素在网格中的自动定位与旋转、移动、倾斜和缩放等变换效果。

weixin_34718952的博客 406

一个网上找到的,在Grid中嵌套Grid的示例:Nested Grids Example

示例地址:http://mikhailstadnik.com/ext/examples/nested-grid.htm

webdev 946

掌握CSS网格布局的术语与语法

本文深入探讨了CSS网格布局中的关键术语和语法,为网页设计师提供了一套详尽的网格布局指导。从网格容器、网格线、网格轨道、网格单元、网格区域到网格项目的定义,再到如何创建显式和隐式网格,以及如何在网格中放置项目,本文逐步解释了网格布局的每个方面。

weixin_34718952的博客 328

jqwidgets嵌套列表Nested Grids实现全展和全缩

 jqwidgets控件对于Nested Grids嵌套列表是不提供全展和全缩的,这时需要我们写一个循环遍历列表展开和缩进代码。 首先的定义一个触发全展和全缩的控件,这里定义CheckBox 关闭 然后给控件设置样式 $("#jqxCheckBox").jqxCheckBox({ width: 50, height: 25, theme: theme }); 其次些控制列表展开和收

xd2596804的专栏 2604

ANSYS Fluent嵌套网格介绍及视频

ANSYS Fluent嵌套网格介绍及视频,涉及动网格相关知识ppt和视频解说。

生物信息学名词解释 | K-mer (长度为k的短序列)

K-mer 何谓K-mer 所谓Kmer,即为一段长度为k的DNA片段,是由测序reads剪切一部分得到的。k为一个奇数,k=几,就为几mer。 比如:我的测序reads长度为100bp,我将这100bp打断成17bp的短片段,打断后的17bp段片段就叫17mer,可以获得(100-17+1)条k-mer序列。 Table1 k-mers for GTAGAGCTGT. k k-mers 1 G,T,A,G,A,G,C,T,G,T 3 GTA,TAG,AGA,GAG,AGC,GCT,CT

qq_50637636的博客 2万+

火列星屯--最强大的CSS布局方案

一、总论 首先给出结论:网格布局(Grid)是最强大的 CSS 布局方案。 虽说如此,但是仍要重视具体的应用场景,如果有其他写法可以提高代码的简洁和可读性,未必非要选择Gird不可。 网格布局就如同它的字面意思,利用它可以比较灵活的将网页分割成若干网格,并且可以把这些网格进行多种组合,搭配出各式各样的布局。 目前浏览器已经内置了网格布局,借助网格布局可以摒弃复杂繁多的CSS代码或框架而实现...

qq_34865249的博客 956

CCF 第一届算法竞赛 CACC 区域赛回忆版题解

觉得这次题出的都还不错,于是记录下。

qq_51602939的博客 8657

css【详解】grid布局—— 网格布局(栅格布局)

目录 gird布局 和 flex布局的区别 Grid 布局的基本术语 网格布局的使用方法 启用网格布局display: grid 划分列grid-template-columns 绝对值 px 百分比值 % 比例值 fr auto值 minmax()函数值 repeat()函数值 划分行grid-template-rows 自动填充auto-fill 给网格线命名 [] 设置行/列的间距 指定区域 不属于任何区域的单元格,用.表示 多个单元格合并成一个区域 改...

朝阳39的博客 6万+

Transformers在自动驾驶领域的应用(High-level like in scene)

Transformers uses global attention mechanism to capture long-range interaction information. Two core modules in Transformers are Self-Attention and Cross-Attention, which defined asAttn(Q,K,V)=softmax(QK⊤dk)VSelfAttn(X)=Attn(WQX,WKX,WVX)CrossAttn(X,Y)=Attn

qq_39337332的博客 1789

SocraticLM: Exploring Socratic Personalized Teaching with Large Language Models

大型语言模型(LLM)被认为是推进智能教育的一项关键技术,因为它们展示了深入理解教学场景和为学生提供个性化指导的潜力。然而,当前个性化教学中基于LLM的应用主要遵循“问答”范式,学生被动地获得答案和解释。在本文中,我们提出了苏格拉底式教学模式(SocraticLM ),它实现了一种苏格拉底式的“发人深省”的教学范式,实现了真正的课堂教师的角色,让学生积极参与到真正掌握解决问题所需的思考过程中。

weixin_43961909的博客 2901

CSS 中grid - template - areas属性的作用,如何使用它创建复杂的网格布局?

属性就像是一个强大的布局神器,让你可以像搭积木一样轻松创建复杂的网格布局。只要给网格区域起好名字,然后把元素放到对应的区域里,就能打造出你想要的布局效果。快去试试吧,让你的网页布局变得更加酷炫!除了属性,还有哪些属性可以用于创建复杂的网格布局?在 CSS 中,除了。

前端大白话 1512

【3D Slicer】的小白入门使用指南一

3D Slicer 是一个免费的开源软件平台,用于医学、生物医学和其他 3D 图像的可视化、处理、分割、配准和分析。Slicer 的功能包括:读/写。

图挖掘领域,新晋砖家 ☞ 未来可期,欢迎和静静一起学习交流吖 5574

CSS网格布局(Grid)响应式设计:创建复杂响应式页面(附完整代码)

本文介绍了使用CSS Grid布局创建响应式网页的方法。Grid布局通过将页面划分为网格容器和网格项,实现复杂布局。文章详细讲解了Grid布局原理、响应式网格设置方法,并提供了完整的HTML/CSS代码示例,包括创建网格容器、设置3列布局以及通过媒体查询实现小屏幕单列适配。同时指出了解决不同设备布局错乱问题的调试技巧,为后续学习Flexbox布局打下基础。文章还提供了系列专栏导航,帮助读者系统学习前端技术。

fykam的博客 803

WPF数据绑定Binding对数据的转换与效验(四)

Binding的作用就是架在Source与Target之间的桥梁,数据可以在这座桥梁的帮助下来流通。就像现实世界中的桥梁会设置一些关卡进行安检一样,Binding这座桥上也可以设置关卡对数据的有效性进行检验,不仅如此,当Binding的两端要求使用不同的数据类型时,我们还可以为数据设置转换器。Binding用于数据有效性检验的关卡是它的ValidationRules属性,用于数据类型转换的关卡是它的Converter属性。

qq_30725967的博客 1638

Linux Kernel入门到精通系列讲解(RV-Kernel 篇) 5.6 在kernel 中实现系统复位和系统关机驱动

上一章节`Qemu`篇我们已经实现了我们`SOC`的`power reset`和 `power down` 寄存器,本章节我们就在`Linux driver`中去实现它

DSMGUOGUO的博客 557

布局的神---网格布局最全总结,建议点赞收藏

网格布局 一、什么是网格布局 网格布局,顾名思义就是像网一样有一个个格子一样的布局。在一个容器里面,我们可以切割成很多行很多列,形成一个个网格,从而对这些网格进行规则性的排序,使用,达到我们复杂的页面布局效果。 Grid 布局与 Flex 布局有一定的相似性,都可以指定容器内部多个项目的位置。但是,它们也存在重大区别。 Flex 布局是轴线布局,有主轴和侧轴之分,只能指定容器内子元素针对轴线的位置,可以看作是一维布局。Grid 布局则是将容器划分成"行"和"列",产生单元格,然后指定"项目所在"的单元格,

Mq_sir的博客 1万+

银河麒麟编译libjpeg库并配置qt环境

银河麒麟下编译libjpeg库并配置qt环境验证

小米的修行之路 1022

【前端】CSS布局问题之网格布局

对于一个偶尔需要谢谢前端界面的我来说,今天了解到了HTML前端可以用网格布局之后,整个人都轻松起来了。在基于C#做手持设备开发和安卓应用程序里,都常用网格来进行布局。而在网页前端,我几乎都是用用Bootstrap这种框架来设定布局,对于基础的CSS控制样式还能搞定,但是涉及到布局,就一头雾水。 比如最近用到float:left这种布局,碰到元素之间崩塌的情况,就是元素位置根本不按照设想的来,看了一...

Bing's Blog 1984

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

【Web前端】“CSS 网格”二维布局系统(补充)

CSS 网格布局是一种二维布局系统,用于网页设计。通过使用网格,你可以将内容以行和列的形式进行排列。此外,网格布局还能够简便地实现一些复杂的布局结构。

一条晒干的咸鱼的博客 2171

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

CSS网格布局:打造现代网页设计的强大工具

在现代网页设计中,布局的灵活性和美观性至关重要。随着需求的不断变化,CSS 网格布局(CSS Grid Layout)作为一种新兴的布局方式,正在成为开发者们的首选工具。它能够轻松创建复杂的网格结构,使得网页设计更加高效和便捷。

weixin_44520557的博客 1824

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

【CSS】网格布局(简单布局、网格合并、网格嵌套)

CSS网格布局是一种强大的CSS布局系统,它简化了页面的布局和定位,同时适应不同屏幕大小的需求。通过使用grid-row和等属性,我们可以轻松地实现简单到复杂的网格布局。网格合并和嵌套使得在网格中创建复杂的布局变得更加简单和灵活。

HYY的博客 4128

css 网格布局_使用CSS网格创建破碎的网格布局

在本教程中,我们将使用CSS Grid来帮助我们创建“破碎的网格布局”,而这对于更传统CSS布局方法而言始终是困难的。 这是我们正在努力的目标( 请查看较大的版本以获取完整效果): 此设计基于Anthony Harmon的工作,而Anthony Harmon的工作非常适合我们的演示。 看看他为Rel Acoustics做的这种布局 : 干杯安东尼:) 网络图形设计 多年来,We...

Web design 教程小屋 520

CSS网格布局笔记[转]

CSS网格布局笔记[转] 参考:CSS Grid教程第1集 - 创建网格容器_哔哩哔哩_bilibili https://codepen.io/brandonzhang https://codepen.io/brandonzhang/pen/MWEYrrJ 查看网格布局线条: 开发者工具独立窗口: 创建网格容器 示例1: 示例2: fr单位和repeat()函数示例1: 示例2 示例3: 网格单元和网格区域 示例1: 示例2: 示例3...

baidu_41388533的博客 1936

html,css 最全grid网格布局教程

网址: http://www.ruanyifeng.com/blog/2019/03/grid-layout-tutorial.html

PrimaryColor 1054

CSS布局 - 网格布局:CSS网格布局用于实现复杂的自适应网格布局效果

在Web开发中,网页布局一直是一个重要的话题。而CSS网格布局为我们提供了一种强大且灵活的方式来实现复杂的自适应网格布局效果。本文将介绍CSS网格布局的基本概念和用法,并通过具体的代码实例来演示如何创建网格布局。CSS网格布局是一种二维布局系统,它允许开发者将页面划分为行和列,从而实现灵活的网格布局。通过定义容器和子元素的属性,我们可以轻松地实现响应式设计和复杂布局效果。CSS网格布局是一种强大的工具,可以帮助我们实现复杂的自适应网格布局效果。

Quantity>Quality 380
上一篇: css 网格布局_CSS DayCSS网格布局
下一篇: css 网格布局_准备好CSS网格布局
普通网友
博客等级 码龄11年 64粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值