margin

css细节复习笔记——基本视觉格式化

北慕城南 提交于 2020-01-03 05:48:13
css包含如此开放、如此强大的一个模型,对于这样一个模型,可以有无数种方法结合应用各种属性,可以得到的效果数不胜数。 基本框 css假定每个元素都会生成一个或多个矩形框,这称为元素框。各元素中心有一个内容区,这个内容区周围包含可选的内外边距和边框(之所以认为是可选,是因为可以设置为0)。 对不同类型的元素格式化时存在着差别。块级元素的处理就不同于行内元素,而浮动元素和定位元素也分别有各自不同的表现。 包含块 每个元素都相当于包含块摆放;可以这么说,包含块就是一个元素的”布局上下文“,css2.1定义了一系列规则来确定元素的包含块。 常用名词: 正常流, 文本从左向右,从上向下显示。要让一个元素不在正常流中,唯一的办法是使之成为浮动或定位元素。 非替换元素 , 如果元素的内容包含在文档中,则称之为非替换元素。 替换元素 , 指用作为其他内容占位符的一个元素。替换元素的一个经典例子就是img元素。它只是指向一个图像文件,这个文件将插入到文档流中该img元素本身的位置。 块级元素 , 这是指段落、标题或div之类的元素。这个元素在正常流中,会在其框之前和之后生成”换行“,所以处于正常流中的块级元素会垂直摆放。通过声明display:block,可以让元素生成块级框。 行内元素, 这是指strong或span之类的元素。这个元素不会在之前或之后生成”行分割符“,它们是块级元素的后代

css整理-04 基本视觉格式化

限于喜欢 提交于 2020-01-03 05:48:01
基本框 假定每一个元素都会生成一个火多个矩形框,为元素框 元素框中心有一个内容区,周围有内边距,边距和外边距 内容的背景会应用到内边距,外边距是透明的,可以看到父元素的背景 内边距不能是负值,外边距可以 包含块 每个元素相对于其包含块摆放,包含块就是一个元素的布局上下文 包含块是由最近的块级祖先框,表单元格火行内祖先框的内容边界构成 行内元素的摆放方式不直接依赖于包含块 水平格式化 使用auto 如果设置 width,margin-left,margin-right 中两个值为特定值,其余一个为 auto ;则设定 auto 的值会确定所需的长度使元素框的宽度等于父元素的长度 如果这三个值都为特定值,那么总会将 margin-right 强制为 auto 如果 margin-left,margin-right 设置为 auto 就会居中 如果将一个外边距和 width 设置为 auto ,另一个设置为具体值,那么设置为 auto 的外边距会成0, width 会设置为所需的值 三个都设置为0,等价于默认 负外边框 根据等式可能会超出父元素范围 百分数 边框的宽度不能使百分数 替换元素 非替换元素的所有规则同样适用于替换元素 除了:如果 width 设置为 auto ,元素的宽度则是内容的固有宽度 垂直格式化 一个元素的默认高度由其内容决定 垂直属性 如果正常流中块元素 margin

css margin:auto not centering div in webkit browsers (Chrome and Safari) when maximised/full screen

孤人 提交于 2020-01-03 04:33:09
问题 I have been unable to determine the cause of this problem, so I can not display a test case, instead I have narrowed down my code to a page that still contains the fault without too much extra. Here is the link: http://www.richard-walsh.limewebs.com/Disk-Edits/index.html The problem is that the content div (id=content), is not centering in Chrome and Safari. It is positioned to the right. The content div is surrounded by a div called bottom, whose width:100%; and height:auto;. #bottom{ width

Gnuplot: how to avoid white margin in PDF through adjusting page size and other parameters

佐手、 提交于 2020-01-02 07:47:41
问题 Here is my code: set term pdfcairo enhanced dashed size 5,3; set output "plot.pdf"; f(x,y)=sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x) set size square set xrange [-5:5] set yrange [-5:5] set contour base set cntrparam level incremental -3, 0.5, 3 set palette rgbformulae 33,13,10 set pm3d map set isosample 250, 250 unset key set lmargin at screen 0.1; set rmargin at screen 0.95; set bmargin at screen 0.2; set tmargin at screen 0.95; splot f(x,y) with pm3d Here is the corresponding

Margins and negative margins

心不动则不痛 提交于 2020-01-02 04:20:27
问题 I've always thought I understood margins and negative margins but apparently I don't! I've just started a new design and running into problems already. I have a div (hill3Cont) and another div (hill3Hill) nested inside, and this is the CSS for them. #hill3Cont { width: 100%; background-image: url("images/grass.jpg"); } #hill3Hill { margin: -100px 0 0 0; height: 600px; width: 100%; background: url("images/hill3.png") no-repeat center top; } I have applied a negative margin to the top of the

WPF---数据绑定之PasswordBox绑定

自古美人都是妖i 提交于 2020-01-02 04:07:53
一、概述 众所周知,绑定的源既可以是依赖属性也可以是普通的CLR属性,而 绑定的目标只能是依赖属性 。 控件PasswordBox的Password属性不是依赖属性,不可以作为绑定的目标与后台数据进行绑定,而在MVVM模式中,前台和后台的绑定是经常需要的,为了达到这种目的,我们可以借助附加属性来实现PasswordBox的Password属性的绑定。 二、绑定思路 思路如下: 1)定义一个PasswordBoxHelper类,在类中定义PasswordProperty、AttachProperty和IsUpdatingProperty三个附加属性以及相应的属性改变事件; 2)在AttachProperty的OnAttachPropertyChanged事件中添加PasswordBox的PasswordChanged事件处理程序,这样PasswordBox控件中输入密码的时候,就会触发PasswordBoxHelper类中PasswordChanged事件处理函数; 3)PasswordChanged事件处理函数执行的时候,把控件中的信息赋值给PasswordBoxHelper类中的依赖属性PasswordProperty; 三、Demo <Window x:Class="PasswordBinding.MainWindow" xmlns="http://schemas

CSS margin auto not centering

点点圈 提交于 2020-01-02 01:51:08
问题 I have simplified the code as much as possible, but still can't get it to center. I believe my inexperience with CSS is not allowing me to see something extremely simple. If anyone also knows some good resources for css, that'll be great. I have read sections of many CSS books but there all very basic and cover the same thing. CSS Markup: /* MAIN ––––––––––––––––––––– */ html { /* overflow-y:scroll; */ } body { /* margin:0; */ /* position:relative; */ } /* Form ––––––––––––––––––––– */ #form

web前端入门到实战:css实现竖直居中的 N 种场景及 N 种方法

时光毁灭记忆、已成空白 提交于 2020-01-01 15:14:22
inline 或者 inline-* 的元素竖直居中 可以借助 padding, line-height, vertical-align 等属性。有如下两种具体情景: 单行竖直居中,如单行文本或者链接 这种情况,通过给元素上下添加相同大小的 padding 值即可实现竖直居中。 <div class="container"> <p>单行文本竖直居中,添加相同的 padding-top & padding-bottom 值</p> </div> body { margin: 0; } .container { background-color: #fe435e; padding: 10px; } p { margin: 0; color: #fff; /* 相同的上下 padding 值使单行文字居中 */ padding-top: 100px; padding-bottom: 100px; } 专门建立的学习Q-q-u-n:⑦⑧④-⑦⑧③-零①② ,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习技巧 (从零基础开始到前端项目实战教程,学习工具,全栈开发学习路线以及规划) 如果不想使用 padding 不方便使用 padding 时,可以通过给元素设置 line-height,使其等于父容器的高度,从而实现竖直居中。注意,此时记得要考虑父容器的 padding 和

css margin-top property only works if border is declared [duplicate]

妖精的绣舞 提交于 2020-01-01 10:56:18
问题 This question already has answers here : Why does this CSS margin-top style not work? (12 answers) Closed 5 years ago . Well, It has been sometime since this keep popping in and I never had the time to ask why: so here is my very simple HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Page Title</title> <style> div{ width: 200px; background: green; } p{ background: yellow; margin: 40px; } </style> </head> <body> <div> <p>Testing</p> </div> </body> </html> nothing particular,

Position absolute and margin: auto

给你一囗甜甜゛ 提交于 2020-01-01 09:18:40
问题 I've got a small problem, I want my footer to stay at the bottom of the screen with position: absolute . But my margin: auto to put it in the middle of the screen isn't working anymore. html: <!DOCTYPE html> <html> <head> <meta http-equiv='Content-Type' content='Type=text/html; charset=utf-8'> <link rel="shortcut icon" href="../IMAGES/favicon.ico"> <title>TEST</title> <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'> <link rel="stylesheet"