flexbox布局_这是您可以使用FlexBox制作的5种布局
flexbox布局
The CSS Flexible Box Layout — Flexbox — provides a simple solution to the design and layout problems designers and developers have faced with CSS. Let me show you how to use it to generate some common layouts and challenges that you will face in designing a responsive website design.
CSS灵活框布局(Flexbox)为设计人员和开发人员使用CSS所面临的设计和布局问题提供了简单的解决方案。 让我向您展示如何使用它来生成一些常见的布局和设计响应式网站设计时将面临的挑战。
I assume you already know the basis of Flexbox. If not there are many documents teaching you about Flexbox. I would recommend Understanding Flexbox: Everything you need to know.
我假设您已经知道Flexbox的基础。 如果没有,那么有很多文档可以教您关于Flexbox的知识。 我建议您了解Flexbox:您需要了解的所有内容 。
这就是我们将要做的 (Here is What We Will Be Making)
In this article, I am going to show you how to make 7 different layouts using FlexBox.
在本文中,我将向您展示如何使用FlexBox制作7种不同的布局。
- Navigation导航
- Center image on screen屏幕中央图像
- Responsive website layout响应式网站布局
- AddOn for input fields输入字段的插件
- 3 column layout3列布局
获取代码 (Get The Code)
All of the examples that I am going to show can be downloaded from my GitHub account. The code for every example is just html and css. I have created a master homepage that provides a link to every example that we are going to cover.
我要显示的所有示例都可以从我的GitHub帐户下载 。 每个示例的代码都是html和CSS。 我创建了一个母版主页,该主页提供了指向我们将要介绍的每个示例的链接。
导航 (Navigation)
Every website has a navigation. Using Flexbox you can create a navigation that has your company name on the left and menu items on the right.
每个网站都有导航。 使用Flexbox,您可以创建一个导航,该导航的公司名称在左侧,菜单项在右侧。
To accomplish this layout in CSS, you would have to use floats to get some content to appear on the left and the rest of the content to appear on the right.
要在CSS中完成此布局,您将必须使用浮点数使一些内容显示在左侧,而其余内容显示在右侧。
With FlexBox you have to specify a flex container that contains the navigation. The company name on the left is a flex item within this container.
使用FlexBox,您必须指定一个包含导航的flex容器。 左侧的公司名称是此容器中的弹性项目。
The menu items on the right are their own flex container with a <ul> containing all the menu items.
右侧的菜单项是它们自己的flex容器,带有<ul>,其中包含所有菜单项。
Here is the html for the navigation:
这是导航的html:
Here is the CSS for the navigation:
这是导航CSS:
屏幕中心图像 (Center Image on Screen)
Many websites include a full size image. Usually this image contains text that is centered on the screen.
许多网站都包含完整尺寸的图片。 通常,此图像包含在屏幕上居中的文本。
The challenge is styling the image so that it fits full page regardless of whether you are viewing this on a wide screen monitor, laptop, tablet or phone and have the CSS remain centered on the screen. Flexbox makes it easy to do this. To mimic text centered on the screen I have included a button
挑战在于对图像进行样式设置,以使其适合整个页面,无论您是在宽屏显示器,笔记本电脑,平板电脑还是手机上查看图像,并且CSS始终位于屏幕中央。 Flexbox使其易于执行此操作。 为了模仿屏幕上居中的文本,我添加了一个按钮
Here is the html to center an image on the screen:
这是将图像放在屏幕中央的html:
Here is the css to center an image on the screen:
这是使图像在屏幕上居中CSS:
响应式网站布局 (Responsive Website Layout)
Almost every website has the same layout which contains a navigation across the top and a footer at the bottom. In between there are 3 columns consisting or a right and left sidebar and the main content area. Generally the main content area takes up 60% of the width of the screen and the two sidebars are allocated 20% of the screen each.
几乎每个网站都具有相同的布局,其中包含顶部的导航和底部的页脚。 在它们之间有3列,分别是左右边栏和主要内容区域。 通常,主要内容区域占据屏幕宽度的60%,两个侧边栏分别分配给屏幕的20%。
The challenge for creating a responsive website is having the footer stay at the bottom of the page regardless of how much content is displayed. The content area should scroll if there is more than can be displayed on the page.
创建响应式网站的挑战在于,无论显示多少内容,页脚都位于页面底部。 如果页面上显示的内容超出范围,则内容区域应滚动。
Here is the html for the responsive website layout:
这是响应式网站布局的html:
Here is the css code for the responsive website layout:
这是响应式网站布局CSS代码:
输入字段的附加组件 (AddOn for Input Field)
To improve your user experience, many designers prefer to put images or text in their input fields. This provides the user with directions on what should be included in the field.
为了改善您的用户体验,许多设计师更喜欢将图像或文本放在其输入字段中。 这为用户提供了有关该字段应包含的内容的指导。
With traditional CSS that was very challenging and required you to use a table format to insert something before or after an input field. With Flexbox it is much easier.
对于传统CSS来说,这非常具有挑战性,需要您使用表格格式在输入字段之前或之后插入内容。 使用Flexbox会容易得多。
Here is the html code for the addon for input fields:
这是用于输入字段的插件的html代码:
Here is the css code for addon for input field:
这是输入字段的插件CSS代码:
3列布局 (3 Column Layout)
It is very common for websites to include a 3 column layout on the screen.
网站在屏幕上包含3列布局是很常见的。
Here is the html for a 3 column layout:
这是3列布局的html:
Here is the css for the 3 column layout:
这是3列布局CSS:
更多文章 (More Articles)
Thanks for reading my article. If you like it, please click on clap icon below so that others will find the article. Here are some more of my articles that you might be interested in:
感谢您阅读我的文章。 如果喜欢,请单击下面的拍手图标,以便其他人可以找到该文章。 以下是您可能感兴趣的其他一些文章:
Think outside the box with CSS shape-outside7 Things I learned in my journey from coding bootcamp to Senior DeveloperWhy Company Culture is Important to Your Career as a Software Engineer
从CSS 构架到高级开发人员的 整个过程中, 我学到了7件事,这在 CSS外形之外进行了全面思考, 为什么公司文化对您作为软件工程师的职业至关重要
翻译自: https://www.freecodecamp.org/news/here-are-5-layouts-that-you-can-make-with-flexbox-6ca1e941f33d/
flexbox布局
相关文章:

数据结构之线性表
数据结构之线性表 目录 概述顺表特点 顺表的操作 准备 创建顺表 查询顺表长度 遍历顺表 按序查找 按值查找 插入 删除 链表实际使用概述 线性表是一种线性的存储结构,表头有唯一后继元素,表尾有唯一前驱元素,表中的元素既有前驱又有后继 顺表…

【BZOJ-3456】城市规划 CDQ分治 + NTT
题目链接 http://www.lydsy.com/JudgeOnline/problem.php?id3456 Solution 这个问题可以考虑dp,利用补集思想 N个点的简单图总数量为$2^{\binom{N}{2}}$,要求的是简单联通图,所以可以用总量减不连通的。 不连通的可以通过枚举与某个固定点的…

微信小程序获取openid和session_key并且把openid存入数据库
微信小程序开发交流qq群 581478349 微信小程序获取openid和session_key并且把openid存入数据库。已经调用openid的demo 前后端代码都有,后端php实现 在其它地方同步调用openid。(确保用户完成登录再进行后续的操作); onLoad…

如何通过五个简单步骤成为更好的Stack Overflow用户
by Artem Stepanenko由Artem Stepanenko 如何通过五个简单步骤成为更好的Stack Overflow用户 (How to become a better Stack Overflow user in five simple steps) Software developers cannot imagine their lives without Stack Overflow.没有堆栈溢出,软件开发…

wm_concat
select org_name,department,to_char(wm_concat(ebs_org_num)) from GHB.org_add_tmp group by org_name,department ; 转载于:https://www.cnblogs.com/pier22/p/6546726.html

5 MySQL索引
目录: 1. 索引概述 1.1 为什么引入索引 1.2 什么是索引 1.3 索引的好处 1.4 索引的不足 1.5 索引分类 2. 索引设计原则 3. 索引建立和删除 3.1 索引创建 3.2 索引删除 4. 索引实验 1. 索引概述 1.1 为什么引入索引[1] 问题:假设数据库中一个表有10^6条记…

js多维数组渲染HTML js for循环渲染页面
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 直接上代码,有不懂的可以留言。 <!DOCTYPE html> <html><head><meta charset"UTF-8"><script src"https://cdn.bootcss.com/jquery/2.1.1/jquery…

使用TensorFlow跟踪千年猎鹰
by Nick Bourdakos由Nick Bourdakos 使用TensorFlow跟踪千年猎鹰 (Tracking the Millennium Falcon with TensorFlow) At the time of writing this post, most of the big tech companies (such as IBM, Google, Microsoft, and Amazon) have easy-to-use visual recognition…

POJ2387 Til the Cows Come Home -DIJKSTRA 练习
题目大意是:有N个牛棚和T条边相连,每条边有个权值,问1号到N号牛棚之间的最短距离 本题是又是DIJKSTRA最短路水题,注意任何两个牛棚之间可能有多条路相连,输入时先输入边,再输入点,程序如下&…

<a>标签带参数跳转并在下一个页面接收
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 正文: <a href"home.html?id1">跳转</a> //home.html <script type"text/javascript"> var aGetRequest();console.log("id:"a[id]) //…

Linux上PHP加入环境变量
export PATH$PATH:/usr/local/php/bin转载于:https://www.cnblogs.com/ttiandeng/p/6554902.html

计算机本科学位有用吗_我应该回到学校获得计算机科学学位吗?
计算机本科学位有用吗by Preethi Kasireddy通过Preethi Kasireddy 我应该回到学校获得计算机科学学位吗? (Should I go back to school to get a Computer Science degree?) This week’s question for my “Ask Preethi’ series is one that’s near and dear t…

[bzoj1054][HAOI2008]移动玩具
题意:在一个4*4的方框内摆放了若干个相同的玩具,某人想将这些玩具重新摆放成为他心中理想的状态,规定移动 时只能将玩具向上下左右四个方向移动,并且移动的位置不能有玩具,请你用最少的移动次数将初始的玩具状态移动到…

微信小程序实现滑动tab切换和点击tab切换并显示相应的数据(附源代码)
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 正文: 先上效果图: 这里主要用到了swiper组件和三目运算,直接上代码, 样式只有三个class,简单粗暴,懒的小伙伴们可以直接拿来用&a…

使用java.util.Timer来周期性的执行制定的任务
使用java.util.Timer来周期性的执行制定的任务 1 public class HandlerTest extends Activity {2 int[] images new int[] {3 R.drawable.baiyang, R.drawable.jinniu, R.drawable.shuangyu4 };5 6 int currentImageID 0;7 8 Override9 prot…

数据库更行通知_哪个更好? 数据驱动还是数据通知?
数据库更行通知by Casper Sermsuksan由Casper Sermsuksan 哪个更好? 数据驱动还是数据通知? (Which is better? Data-Driven or Data-Informed?) I recently spoke at the Tech in Asia Product Development Conference in Jakarta about being data-…

从某一日期开始过day天的日期
一个SX问我的,我就写了写......从2010.1.1开始,给了一组测试数据3的话输出2010.1.4星期1,所以说2010.1.1是星期五,总星期就是 (day5)%70?7:(day5)%7下面是代码...... #include <iostream> #include <stdlib.h> using…

dhtmlxgrid表格笔记
因为公司以前架构的需求,所以对于dhtmlxgrid进行了简单的学习,参照dhtmlxgrid给出的例子进行摸索 1、必须引入的js包 <link rel"STYLESHEET" type"text/css" href"css/dhtmlxgrid.css"> <link rel"stylesh…

配置 腾讯云 SSL 证书 SSL证书实现https,环境:phpStudy下Apache环境
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 正文: SSL证书实现https,环境:phpStudy下Apache环境 前提条件: 1.申请并下载好腾讯云申请的免费 ssl证书 腾讯云免费证书申请地址: http…

把canvas放在盒子内_如何将您的专业知识放在盒子中并出售
把canvas放在盒子内At RISE Conf in Hong Kong, Gary Vaynerchuk was asked:在香港的RISE Conf会议上, 加里韦纳楚克被问到: How do I make a living off my passion?我如何以激情为生? The answer from the marketing mogul was strai…

bzoj 4771: 七彩树 树链的并+可持久化线段树
题目大意: 给定一颗树,询问树中某个点x的子树中与其距离不超过d的所有点中本质不同的颜色数 强制在线 题解: 一下午终于把这道题叉掉了。 写了三个算法,前两个都是错的,后一个是%的网上大爷们的题解. 首先我们发现这道题有一个特点:没有修改操作 !! 这就使我们能够对颜色进行预…

Chapter 0: 引论
引论我之前就看过了,在我刚买到这本书的时候。 而我买这本书的日子,已经是两年前了。我就是这样子的,我买了好多好多关于技术的书,这些书都是很贵很贵的,可是买完回来之后就看了第一章,然后就一直丢在一边&…

开发常用CSS
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 正文: keyframes -> 使 div 元素匀速向下移动 div{animation:myanimation 5s infinite;} keyframes myanimation {from {top:0px;}to {top:200px;}} 注:animation ->Css3动画属性 …

javascript网络_没有JavaScript的网络外观
javascript网络A Berlin-based web developer — who codes JavaScript for a living — decided to go an entire day without JavaScript.一家位于柏林的网络开发人员(为JavaScript编写代码为生)决定不使用JavaScript进行一整天的工作。 Let’s face it — in an insane wor…

js中的各种宽高以及位置总结
在javascript中操作dom节点让其运动的时候,常常会涉及到各种宽高以及位置坐标等概念,如果不能很好地理解这些属性所代表的意义,就不能理解js的运动原理,同时,由于这些属性概念较多,加上浏览器之间 实现方式…

关于百度编辑器UEditor在asp.net中的使用方法!
为了完成自己想要的功能效果,在项目中使用到了百度编辑器,为了搞明白,苦心学习查资料搞了整整一天,总结一下。 在asp.net 的项目中目前我觉得有两种情况,一种是没有使用模板页的,一种是使用了模板页的&…

微信小程序点击图片实现长按预览、保存、识别带参数二维码、转发等功能
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 正文: 先上效果图,再附上完整源码: 1.多张图片循环渲染后预览、保存、识别带参数二维码 <view wx:for"{{imgalist}}" class"previewimg">…

vba编程教程视频教程_我已经完成了编程教程。 怎么办?
vba编程教程视频教程by Preethi Kasireddy通过Preethi Kasireddy 我已经完成了编程教程。 怎么办? (I’ve done programming tutorials. Now what?) This week’s question for my Ask Preethi series is about how to go from simply doing tutorials to the act…

【官方文档】Nginx负载均衡学习笔记(二)负载均衡基本概念介绍
简介 负载均衡(Server Load Balancer)是将访问流量根据转发策略分发到后端多台 ECS 的流量分发控制服务。负载均衡可以通过流量分发扩展应用系统对外的服务能力,通过消除单点故障提升应用系统的可用性。 负载均衡主要有如下几个功能点&#x…

微信小程序本地缓存
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 正文: 关于微信小程序本地缓存,做一下笔记,希望能够帮助到看到这篇分享的人 //index.js 这里是保存 var a 1 wx.setStorageSync(a, a) //logo.js 这里是取保存的…