display

高度不定的div如何垂直水平居中

不问归期 提交于 2020-01-13 02:27:45
面试经常会被问到这个问题,特地总结了下几种方法。 方法1:display: table <!doctype html> <html> <head> <meta charset="utf-8"> <title>T</title> <style> html,body {margin:0; padding:0; height:100%;} .a {margin:0 auto; width:800px; height:100%; display:table;} .b {display:table-cell; vertical-align:middle;} .c {background:#f11;} p{height:20px;} </style> </head> <body> <div class="a"> <div class="b"> <div class="c"> <br><br><br><br><br><br><br> <p></p> </div> </div> </div> </body> </html> 方法2:定位+transform  .center {     position: fixed;     top: 50%;     left: 50%;     background-color: #000;     width:50%;     height: 50%;  

display:inline-block的优缺点

爷,独闯天下 提交于 2020-01-12 16:13:26
display:inline-block的优缺点 优点 :将元素设置为行内块元素,既有行内元素可以一行显示多个元素的特性,又有块元素可以设置宽高的特性。 缺点 :设置为display:inline-block后,元素与元素之间会多出空格间隙 空隙产生的原因: 当元素有行内元素的特性时,元素间的空白符都会被解析,回车换行会被解析成一个空白符,如果字体不为零那么就会占一定的宽度,并且这些间距会随字体的大小而变化 解决办法 1、写代码时元素间不换行,中间不留空隙,但这样 会导致代码的可读性变差。 2、父元素设置font-size:0px;在子元素上设置想要的字体大小,但万一后面有很多的子元素,这种方法会导致代码冗余。 3、父元素设置display:table;word-spacing:-1em; 4、子元素设置浮动,如果这样做会显得display:inlline-block有点多余,因为块元素设置浮动就能在同一行了,为什么还要设display:inlline-block呢?而且都要清除浮动带来的父盒子塌陷问题。 5、子元素设置margin-left:负数px;(不兼容,不推荐) 来源: CSDN 作者: 有理想,有期待 链接: https://blog.csdn.net/qq_41818857/article/details/103945364

CSS3(5)---伸缩布局(Flex)

人走茶凉 提交于 2020-01-12 01:47:15
原文: CSS3(5)---伸缩布局(Flex) CSS3(5)---伸缩布局 有关页面布局之前写过三篇相关文章: 1、 CSS(5)---盒子模型 2、 CSS(6)---浮动(float) 3、 CSS(8)---定位(position) 一、什么是Flex 布局 1、Flex 布局特点 上面三种布局都是基于盒状模型。依赖 display属性 + position属性 + float属性 。它对于有些特殊布局并不友好,比如,垂直居中就不容易实现,会有溢出容器的问题。 Flex是意思是”弹性布局”,它可以为盒状模型提供最大的灵活性。主要思想是让容器有能力让其子项目能够改变其 宽度 、 高度 、 顺序 ,以 最佳的方式填充可用空间 。 简单来讲就是当你设置好父元素的宽度或者高度,对于它的子元素会根据父类的宽度或者高度来填充可用空间。 2、Flex 布局 任何一个容器都可以指定为 Flex 布局。 .box{ display: flex; } 行内元素也可以使用 Flex 布局 。 .box{ display: inline-flex; } 注意 设为 Flex 布局后,CSS的columns在伸缩容器上没有效果。 子元素(伸缩项目)的 float、clear和vertical-align属性将失效 二、重要概念 1、容器和项目 容器 采用Flex布局的元素,称为Flex容器,简称

Highcharts strange grouping behaviour

◇◆丶佛笑我妖孽 提交于 2020-01-11 14:03:13
问题 I am using the lazy loading method to load OHLC data. On the server side I use Python + MySQL and have 4 tables with OHLC data and time intervals of 5min, 1hour, 1day, 1month. Actually it works well, but unfortunately Highcharts displays the candlesticks in a strange way. Especially at the initial loading and when I switch between the zooms. Here are some examples: 1. Grouping on chart initialization On initial Loading 6h , 24h & 3d is disabled and the candlesticks are wide apart. Only after

Setting the image `width: 0` hides it, while `width: 0%` makes it occupy the space, too

☆樱花仙子☆ 提交于 2020-01-11 09:16:08
问题 The image inside the container element having a specific display type behaves differently when using the img { width: 0; } or img { width: 0%; } style rules. Increasing the value of width using any unit other than % gave the same expected result ( img occupies only the shown part of it). I've tried changing the display type of the container the img is in. The result is shown below. Container display types in which the img is shown not as expected : -webkit-inline-box inline-block inline-flex

display table 标签用法

余生长醉 提交于 2020-01-11 07:39:55
在web.xml下添加一个filter <filter> <filter-name>exportFilter</filter-name> <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class> </filter> 在jsp页面做一个引用: <%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %> 首先我们定义一个list <% List test = new ArrayList( 6 ); test.add( "Test String 1" ); test.add( "Test String 2" ); test.add( "Test String 3" ); test.add( "Test String 4" ); test.add( "Test String 5" ); test.add( "Test String 6" ); request.setAttribute( "test", test ); %> 当我们想在jsp页面上显示这个list时,我们只需要写一句话 <display:table name="test" /> display tag会自动生成一个table 如果list是从控制层抛出来的

CSS 水平居中和垂直居中

浪尽此生 提交于 2020-01-11 05:05:35
转自: http://www.cnblogs.com/fu277/archive/2012/09/13/2400118.html 1.水平居中 (1) 文本、图片等行内元素的水平居中   给父元素设置text-align:center可以实现文本、图片等行内元素的水平居中。 (2) 确定宽度的块级元素的水平居中   通过设置margin-left:auto;和margin-right:auto;来实现的。 (3) 不确定宽度的块级元素的水平居中   方法一:   使用table标签,table本身并不是块级元素,如果不给它设定宽度的话,它的宽度由内部元素的宽度“撑起”,但即使不设定它的宽度,仅设置margin-left:auto;和margin-right:auto;就可以实现水平居中!   将需要居中的部分包含在table标签内,对table设置margin-left:auto;和margin-right:auto;就可以使table水平居中,间接使需要居中的部分水平居中。   缺点:增加了无语意标签,加深了标签的嵌套层数。 <style type="text/css">ul{list-style:none; margin:0; padding:0;}.wrap{ width:500px; height:100px;}table{margin-left:auto;margin

<display:column>属性解释

旧城冷巷雨未停 提交于 2020-01-11 02:31:03
参考官方网站: http://www.displaytag.org/1.2/displaytag/tagreference.html 所有属性: autolink,class,comparator,decorator,defaultorder,escapeXml,format,group,headerClass,headerScope, href,maxLength,maxWords,media,nulls,paramId,paramName,paramScope,paramProperty,property,scope,sortable,sortName, sortProperty,style,title,titleKey,totle,url,value property 主要是用来指明需要显示的元素的属性名,同时表格中的列名也就是property的值(没有title属性时),但是会以大写字母开头。 title 页面中显示的表格的列名。代替property这个默认的列名。 style 这个是正常表格中的td的style属性,用来直接定义CSS样式。 class 这个是正常表格中的td的class属性,用来引用CSS。 headerClass 这个是该列的列名的class属性,也就是th的class属性,可以用来控制列标题样式。 autolink autolink="true"

<display:column>属性解释

巧了我就是萌 提交于 2020-01-10 15:54:20
参考官方网站: http://www.displaytag.org/1.2/displaytag/tagreference.html /*--> */ /*--> */ 所有属性: autolink,class,comparator,decorator,defaultorder,escapeXml,format,group,headerClass,headerScope, href,maxLength,maxWords,media,nulls,paramId,paramName,paramScope,paramProperty,property,scope,sortable,sortName, sortProperty,style,title,titleKey,totle,url,value 注释: 红色行代表没有理解或者还不清楚具体功能,有待补充的...... property 主要是用来指明需要显示的元素的属性名,同时表格中的列名也就是property的值(没有title属性时),但是会以大写字母开头。 title 页面中显示的表格的列名。代替property这个默认的列名。 style 这个是正常表格中的td的style属性,用来 直接定义CSS样式。 class 这个是正常表格中的td的class属性,用来引用CSS。 headerClass

Comparing files, folders and text sources

▼魔方 西西 提交于 2020-01-10 14:56:36
https://www.jetbrains.com/help/idea/comparing-files-and-folders.html Compare folders Select the folders you want to compare in the Project tool window. From the context menu, choose Compare Directories, or press Ctrl+D . Use the following toolbar buttons to filter the list: : click to display files that are present in the left folder, but are missing from the right one. : click to display files that are present in the right folder, but are missing from the left one. : click to display files that are present in both folders, but whose contents, timestamp or size are different. : click to