auto

水平居中布局与滚动条跳动的千年难题

吃可爱长大的小学妹 提交于 2019-12-04 19:52:38
绝大多数的页面间布局都是水平居中布局,主体定个宽度, 然后margin: 0 auto的节奏~例如,妇女之友大淘宝的首页: .warp{ width:1190px; margin:0 auto; position:relative; } 然而,这种布局有一个存在一个影响用户体验的隐患。应该都知道,现代浏览器滚动条默认是overflow:auto类型的,也就是如果尺寸不足一屏,没有滚动条;超出,出现滚动条。于是,问题来了: 1,信息流页面,如新浪微博,是从上往下push渲染的。开始只有头部一些信息加载,此时页面高度有限,没有滚动条;然后,更多内容显示,滚动条出现,占据可用宽度,margin: 0 auto主体元素自然会做偏移——跳动产生。 2,JS交互,本来默认页面高度不足一屏,结果点击了个“加载更多”,内容超过一屏,滚动条出现,页面主体就会左侧跳动。 3,结构类似几个页面通过头部的水平导航刷新切换,结果有的页面有滚动条,有的没有。造成的结果就是,导航尼玛怎么跳来跳去! 当前优化这种体验问题,一般有两种解决方法: 高度尺寸不确定的,例如,新浪微博,使用: body { overflow-y: scroll; } 高度确定的,例如淘宝网首页。使用CSS把页面尺寸布局骨架搭好,再在里面吐数据。于是,要么没有滚动条,要么滚动条直接出现。不会出现跳动。 然而,然而

NFS服务器搭建与autofs自动挂载

空扰寡人 提交于 2019-12-04 18:23:08
NFS 服务器搭建与 autofs 自动挂载 一、 NFS 和 autofs 的简介: NFS 是 Network File System 的缩写,即网络文件系统。一种使用于分散式 文件系统的协定,由 Sun 公司开发,于 1984 年向外公布。功能是通过网络让不同的机器、不同的操作系统能够彼此分享个别的数据,让应用程序在客户通过网络访问位于服务器磁盘中的数据是在类 Unix 系统间实现磁盘文件共享的一种法。 Autofs : mount 是用来挂载文件系统的,可以在系统启动的时候挂载也可以在系统启动后挂载。对于本地固定设备,如硬盘可以使用 mount 挂载;而光盘、软盘、 NFS 、 SMB 等文件系统具有动态性,即需要的时候才有必要挂载。光驱和软盘我们一般知道什么时候需要挂载,但 NFS 和 SMB 共享等就不一定知道了,即我们一般不能及时知道 NFS 共享和 SMB 什么时候可以挂载。而 autofs 服务就提供这种功能,好像 windows 中的光驱自动打开功能,能够及时挂载动态加载的文件系统。免去我们手动挂载的麻烦。要实现光驱,软盘等的动态自动挂载,需要进行相关的配置。 二. NFS 文件详解 1. /data/ 表示需要共享的目录。 2. IP 表示允许哪个客户端访问。 3. IP 后括号里的设置表示对该共享文件的权限。 4. ro 只读访问 5. rw 读写访问 6.

NFC服务器搭建与autofs自动挂载

家住魔仙堡 提交于 2019-12-04 18:21:41
NFC 服务器搭建与 autofs 自动挂载 所需安装环境 RPC RPC = Remote Procedure Call # 共享主机需要 RPC rpcbind NFS nfs-server # 访问主机需要 RPC rpcbind 服务端 NFS 安装 1 yum install nfs-utils -y # 安装 nfs 2 systemctl start nfs # 开启 nfs 服务 3 systemctl enable nfs # 开机自启动 配置 NFS 服务 1 mkdir /westos 2 echo 'hello,world' > /westos/hello # 建立目录 /westos, 在其中创建测试文件 hello 服务端测试 showmount 命令查看指定服务器的 nfs 共享文件信息,常用选项 -e :显示指定服务器输出的共享目录 1 showmount -e 192.168 . 1.152 2 Export list for 192.168 . 1.152 : 3 /westos * 挂载共享目录 1 mount 服务器名或 IP 地址:共享目录 本地挂载目录 2 mount 192.168 . 1.152 :/westos /mnt/ # 将共享目录挂载到本地 /mnt ls /mnt/ 3 hello # 有我们的测试文件,说明目录共享成功

nfs服务器配置和autofs自动挂载

此生再无相见时 提交于 2019-12-04 18:03:13
NFS 服务端:xuegod63.cn IP:192.168.1.63 NFS 客户端:xuegod64.cn IP:192.168.1.64 NFS服务端概述: NFS ,是Network File System的简写,即 网络文件系统 。网络文件系统是FreeBSD支持的文件系统中的一种,也被称为NFS. NFS允许一个系统在网络上与他人共享目录和文件。通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件。 模式: C/S 模式 端口: RHEL6 是以 NFSv4 作为默认版本, NFSv4 使用TCP协议(端口号是2049)和NFS服务器建立连接 安装nfs 1 、安装NFS软件包 [root@xue63 ~]#rpm -vih /mnt/Packages/nfs-utils-1.2.3-15.el6.x86_64.rpm yum -y install nfs-utils 安装客户端: 命令:mount showmount 配置文件位置: [root@xue63 ~]# ls /etc/exports 启动NFS服务 先查看2049端口是否开放: [root@xue63 ~]#netstat -anutp | grep 2049 [root@xue63 ~]# service nfs start Startingntpd: [ OK ] [root

Why is a template with deduced return type not overloadable with other versions of it?

爷,独闯天下 提交于 2019-12-04 17:39:32
问题 Why are the following two templates incompatible and can't be overloaded? #include <vector> template<typename T> auto f(T t) { return t.size(); } template<typename T> auto f(T t) { return t.foobar(); } int main() { f(std::vector<int>()); } I would think they are (more or less) equivalent with the following which compiles fine (as we cannot do decltype auto(t.size()) I can't give an exact equivalent without some noise..). template<typename T> auto f(T t) -> decltype(t.size() /* plus some decay

What are the type deduction rules for auto*?

半世苍凉 提交于 2019-12-04 17:31:45
What are the type deduction rules for auto* ? Consider the following: int x = 64; int* px = &x; auto* v1 = &x; // auto => ??? ok v1 is int* ... auto* v2 = px; // auto => ??? is v2 int* ? auto* v3 = &px; // auto => ??? is v3 int** ? Just to clarify my question if we split the type deduction into two steps: Deducing the type of " auto " itself without ( * ) ... then Deducing the type of the object ( v1 , v2 and v3 ) after adding the ( * ) So my two questions are: What will auto be deduced to without the ( * ) ? Will v2 be pointer to int ( int* ) and v3 pointer to pointer ( int** ) ? If you know

弹性布局的基础讲解

坚强是说给别人听的谎言 提交于 2019-12-04 17:26:43
弹性布局的基础讲解 弹性布局是由w3c在2009年提出的一种布局方法,目前浏览器都已经支持弹性布局(忽略IE6吧)。本文主要讲解弹性布局的基本语法并将其应用到实际网页布局中 如何应用弹性布局,代码如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> *{ margin: 0; padding: 0; } div{ border: 1px solid #ccc; box-sizing: border-box; } .box{ height:20vh; display: flex; } .box div{ flex: 1; } .box div:last-child{ flex: 2; } </style> </head> <body> <div class="box"> <div>Document1</div> <div>Document2</div> <div>Document3</div>

Can a variable be redeclared as auto that deduced to the same type? [duplicate]

六眼飞鱼酱① 提交于 2019-12-04 17:24:37
问题 This question already has answers here : Does a declaration using “auto” match an extern declaration that uses a concrete type specifier? (3 answers) Closed 3 years ago . Is the following allowed by the standard? #include <iostream> extern int a; auto a = 3; int main(int, char**) { std::cout << a << std::endl; return 0; } clang accepts the code. g++ complains for conflicting declaration. 回答1: Its not much clear to me from the standard, but then, there is this written section 7.1.6.4 auto

IE5、IE6、IE7、IE8 的CSS HACK兼容列表

拥有回忆 提交于 2019-12-04 17:15:24
一、CSS HACK 以下两种方法几乎能解决现今所有HACK. 1, !important 随着IE7对!important的支持, !important 方法现在只针对IE6的HACK.(注意写法.记得该声明位置需要提前.) 2, IE6/IE77对FireFox *+html 与 *html 是IE特有的标签, firefox 暂不支持.而*+html 又为 IE7特有标签. 注意: *+html 对IE7的HACK 必须保证HTML顶部有如下声明: http://www.w3.org/TR/html4/loose.dtd "> 二、万能 float 闭合 关于 clear float 的原理可参见 [How To Clear Floats Without Structural Markup] 将以下代码加入Global CSS 中,给需要闭合的div加上 class="clearfix" 即可,屡试不爽. 三、其他兼容技巧 1, FF下给 div 设置 padding 后会导致 width 和 height 增加, 但IE不会.(可用!important解决) 2, 居中问题. 1).垂直居中.将 line-height 设置为 当前 div 相同的高度, 再通过 vertical-align: middle.( 注意内容不要换行.) 2).水平居中. margin: 0

What is the auto Bracketed List Syntax?

左心房为你撑大大i 提交于 2019-12-04 16:48:28
W.F. gave a now-deleted answer to my question here which used the line: auto [x, y] = div_t{ 1, 0 }; From the code in the answer it looks like that's like a tie for the div_t struct. I was hoping that someone could explain what was going on here. The complete function code was as follows: constexpr bool first_quot() { auto [x, y] = std::div_t{1, 0}; (void)y; return x; } In the most most recent draft of the C++17 specification it's called "Decomposition declarations" and is defined in section 8.5 [dcl.decomp]. 来源: https://stackoverflow.com/questions/41569419/what-is-the-auto-bracketed-list