padding

UGUI Image扩展组件

柔情痞子 提交于 2019-12-03 14:26:07
功能: 优化对称图片及九宫格图片内存(对称图片只用一半图片,九宫格只用左下部分四分之一图片)。 核心代码: 1、九宫格翻转代码: /// <summary> /// 赋值九宫vert顶点数据 /// </summary> /// <param name="toFill"></param> /// <param name="rect"></param> /// <param name="padding"></param> /// <param name="adjustedBorders"></param> /// <param name="dir">0-3代表4个方向,分别为0:左下部分;1:右下部分;2:右上部分;3:左上部分</param> private void Generate9SlicedSprite(VertexHelper toFill, ref Rect rect, ref Vector4 padding, ref Vector4 adjustedBorders, int dir) { s_VertScratch[3] = new Vector2((rect.width - padding.z - padding.x) / 2, (rect.height - padding.w - padding.y) / 2); s_VertScratch[2] = s

安卓手机对于消息中心右上角提示小红点的兼容处理

狂风中的少年 提交于 2019-12-03 14:16:45
项目背景 :要实现如图一样的消息提示 问题 :由于项目中使用了postcss-pxtorem的插件,所以导致一些正常的css在安卓机上不是圆的,border-radius写的是px,但是会自动转成rem,从而变成小数,安卓机解析偏差就变形了。 解决方案 :先放大再缩小 1 .unread-info { 2 background-color: #f56c6c; 3 border-radius: 30px; 4 color: #fff; 5 display: inline-block; 6 font-size: 36px; 7 height: 52px; 8 line-height: 52px; 9 padding: 0 16px; 10 min-width: 52px; 11 text-align: center; 12 white-space: nowrap; 13 position: absolute; 14 transform: translateY(-50%) translateX(100%) scale(0.25); 15 transform-origin:center left;/*由于小圆点的伸缩方向需要是右边,所以这样改,center的话会像两边扩展,位置就会跑偏*/ 16 top: 6px;/*这是对于父元素的定位*/ 17 right: 40px; 18 } 19

Anchor not to top of page, but 200px down

混江龙づ霸主 提交于 2019-12-03 13:39:38
I have an anchor on a element which makes the navigation jump to that point. However the anchor snaps it right up to the top of the viewport. Due do a fixed navigation, it's now hidden behind. Is it possible to make the anchor not snap to the top of the viewport and instead 200px down the page? Site here: http://www.haselden.co.uk/james/docs I was able to solve this by actually applying CSS to the anchor. So for the anchor I would have this... <a name="AnchorName" class="anchor"></a> And then in the CSS I would have this... .anchor { position: relative; top: -[number]px; } Note that I have

Firefox/Safari setting height as [specified height - padding - border] for input[type=button]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 13:11:37
When I use the following CSS: input[type=button] { background-color: white; border: 1px solid black; font-size: 15px; height: 20px; padding: 7px; } with this HTML: <input type="button" value="Foo" /> I expect to see this, so the total height becomes 36px : 1px border 7px padding 20px content (with 15px text) 7px padding 1px border But instead both Firefox 3.6 and Safari 4 show this: (Haven't tested in other browsers) Screenshot http://labs.spiqr.nl/upload/files/1223ef9cbae3ab6e43bd1f9215ebedb157ac7b22.png 1px border 7px padding 4px content (with 15px text) => height - 2 * border - 2 * padding

NinePatchDrawable does not get padding from chunk

谁都会走 提交于 2019-12-03 12:37:17
问题 I need help with NinePatchDrawable: My app can download themes from the network. Almost all things work fine, except 9-Patch PNGs. final Bitmap bubble = getFromTheme("bubble"); if (bubble == null) return null; final byte[] chunk = bubble.getNinePatchChunk(); if (!NinePatch.isNinePatchChunk(chunk)) return null; NinePatchDrawable d = new NinePatchDrawable(getResources(), bubble, chunk, new Rect(), null); v.setBackgroundDrawable(d); d = null; System.gc(); getFromTheme() loads the Bitmap from the

bootstrap的响应式布局

♀尐吖头ヾ 提交于 2019-12-03 12:15:16
css ul{ list-style: none; margin: 0; padding: 0; } a{ color: #666; text-decoration: none; } a:hover{ text-decoration: none; } body{ background: #f5f5f5; } .container{ background: #fff; } /* 因为设计稿是1280px的,而bootstrap里面的container最大为1170px,因此我们手动修改container宽度 */ @media screen and (min-width:1280px){ .container{ width: 1280px; } } /* header */ /* 如果header不设置padding-left,它本身有一个左侧内边距,因为我们需要右侧内边距,所以不能使用.row的bootstrap类样式,所以可以用这种方式 */ header{ } .logo{ background-color: #429ad9; } .logo img{ display: block; margin: 0 auto; /* width:100%; */ max-width: 100%; /* logo图片不需要缩放 */ } .logo p{ height: 50px; font

Detect if struct has padding

我是研究僧i 提交于 2019-12-03 12:11:35
Is there a way (trait or so) to detect, if struct/class has some padding? I don't need cross-platform or standardized solution, I need it for MSVC2013. I can check it like namespace A { struct Foo { int a; bool b; }; } #pragma pack(push, 1) namespace B { struct Foo { int a; bool b; }; } #pragma pack(pop) static const bool has_padding = sizeof(A::Foo) != sizeof(B::Foo); But C++ doesn't allow (as far as I know) generate this non-invasive (without touching existing structs) Ideally I would like to get working something like this template <typename T> struct has_padding_impl { typedef __declspec

前端之css

邮差的信 提交于 2019-12-03 11:47:02
前端之css 1 | 0 CSS介绍 CSS( C ascading S tyle S heet,层叠样式表)定义 如何显示 HTML元素。 当浏览器读到一个样式表,它就会按照这个样式表来对文档进行格式化(渲染)。 2 | 0 CSS语法 2 | 1 CSS实例 每个CSS样式由两个组成部分:选择器和声明。声明又包括属性和属性值。每个声明之后用分号结束。 2 | 2 CSS注释 /* 这是注释 */ 注释是代码之母。 3 | 0 CSS的几种引入方式 3 | 1 行内样式 行内式是在标记的style属性中设定CSS样式。不推荐大规模使用。 < p style ="color: red" > Hello world. </ p > 3 | 2 内部样式 嵌入式是将CSS样式集中写在网页的<head></head>标签对的<style></style>标签对中。格式如下: < head >    < meta charset ="UTF-8" >    < title > Title </ title >    < style >      p { background-color : #2b99ff ; }    </ style > </ head > 3 | 3 外部样式 外部样式就是将css写在一个单独的文件中,然后在页面进行引入即可。推荐使用此方式。 < link href

关于box-sizing

懵懂的女人 提交于 2019-12-03 11:37:45
该属性的两个值:content-box , border-box,默认为content-box 1.默认情况,给div设置的宽高就是内容区的大小,不包括padding和border 2.border-box时,div的宽高等于border+padding+content 来源: https://www.cnblogs.com/lzqiao/p/11794249.html

How to increase the distance between table columns in HTML?

≡放荡痞女 提交于 2019-12-03 11:27:07
问题 Let's say I wanted to create a single-rowed table with 50 pixels in between each column, but 10 pixels padding on top and the bottom. How would I do this in HTML/CSS? 回答1: There isn't any need for fake <td> s. Make use of border-spacing instead. Apply it like this: HTML: <table> <tr> <td>First Column</td> <td>Second Column</td> <td>Third Column</td> </tr> </table> CSS: table { border-collapse: separate; border-spacing: 50px 0; } td { padding: 10px 0; } See it in action . 回答2: Set the width of