padding

对于BFC(block format context)理解

怎甘沉沦 提交于 2019-12-03 07:19:27
前言 什么是BFC? 在解释 BFC 是什么之前,需要先介绍Box(块级,行级...)、FormattingContext的概念。 Box: CSS布局的基本单位&盒模型 盒模型--块级盒/行内盒 一个盒包括了内容(content)、边(border)、内边距(padding)、外边距(margin)。下图展示了盒模型的直观意义: 盒的尺寸(width与height--计算得到的offsetWidth和offsetHeight)定义受到box-sizing属性的影响。box-sizing可选择content-box(默认)和border-box两种模式。分别代表两种盒子模型:W3c标准盒模型和IE盒子模型。ie8后开始支持通过CSS3属性box-sizing,让我们可以自由选择采用哪种盒子。 w3c标准盒模型--块级盒 width = content-width + padding-width + border-width height = content-height + padding-height + border-height IE盒子模型--块级盒 width = content-width height = content-height 行内盒 1.width、height不起作用,盒子高度由内容决定(font-size/line-height)决定 2.margin

Remove padding from matplotlib plotting

瘦欲@ 提交于 2019-12-03 06:48:48
I am plotting an image in matplotlib, and it keeps giving me some padding. This is what I have tried: def field_plot(): x = [i[0] for i in path] y = [i[1] for i in path] plt.clf() plt.axis([0, 560, 0, 820]) im = plt.imread('field.jpg') field = plt.imshow(im) for i in range(len(r)): plt.plot(r[i][0],r[i][1],c=(rgb_number(speeds[i]),0,1-rgb_number(speeds[i])),linewidth=1) plt.axis('off') plt.savefig( IMG_DIR + 'match.png',bbox_inches='tight', transparent="True") plt.clf() Try using pad_inches=0 , i.e. plt.savefig( IMG_DIR + 'match.png',bbox_inches='tight', transparent="True", pad_inches=0) From

Extra padding on linked images (in every browser)

泄露秘密 提交于 2019-12-03 06:41:33
I'm having a problem with getting extra padding on link element with an image inside. It happens in all browsers, Safari, Firefox, IE. I have a reset stylesheet applied so there shouldn't be any extra margins on padding but upon inspection it's clear that the a element has some extra bottom padding from nowhere. Any ideas? Here's the markup and CSS: <div class="movie"><a href=""><img src="img/video01.jpg" alt="" /></a></div> div.home-col .movie { padding: 0 0 11px 0; background: url(../img/bg-shadow-movie.png) bottom no-repeat; } div.home-col .movie a { display: block; background: url(../img

Center CheckBox drawable within itself

大憨熊 提交于 2019-12-03 06:22:58
问题 I have a CheckBox that I want centered within its own boundaries, not pushed to the side. Probably easier demonstrated than explained: Note that it isn't centered. Currently defined as: <CheckBox android:id="@+id/checkbox_star" android:layout_width="wrap_content" android:layout_height="match_parent" android:button="@drawable/btn_favorite" android:layout_gravity="center" android:minWidth="48dp" /> Nevermind the custom button drawable. It behaves the same with a vanilla CheckBox as well (the

jQuery calculate padding-top as integer in px

前提是你 提交于 2019-12-03 06:17:53
The only solution i have found is ($(this).innerHeight() - $(this).height()) / 2 But / 2 is not right option, because user can have padding-top:0px and padding-bottom:20px. Is there a way to make more accurate padding values? I was thinking about css('padding-top') and then parse it, by taking only int part, but value can be in "em" for example and not in "px" Then make switch statement for each value type? For em one, for px another? It's all a bit complicated and takes more space in code... One of the main strengths of jQuery is that it is so pluggable, so if you have a need that is not

What would you use to zero pad a number in Flex/AS3?

冷暖自知 提交于 2019-12-03 06:11:35
Duplicate of this one. What would you use to pad zeroes to the left of a number in Flex/AS3? Is there an equivalent to printf or NumberFormat that does this? I'm looking for the nicest implementation of this or something similar: public function zeroPad(number:int, width:int):String { // number = 46, width = 4 would return "0046" } public function zeroPad(number:int, width:int):String { var ret:String = ""+number; while( ret.length < width ) ret="0" + ret; return ret; } Performance-wise, I prefer using a String constant and substr, like this: package { public class Helper { private static

UIButton Text Margin / Padding

你说的曾经没有我的故事 提交于 2019-12-03 06:10:43
问题 I have the following layout, and I'm trying to add a padding to the left and right.. The controls are a disabled UIButton. My code for creating a button is this: UIButton *buttonTime = [[UIButton alloc] initWithFrame:CGRectMake(90, 10, 50, 20)]; [buttonTime setBackgroundImage:[[UIImage imageNamed:@"bubble.png"] stretchableImageWithLeftCapWidth:9 topCapHeight:13] forState:UIControlStateDisabled]; [buttonTime setTitle:@"27 feb, 2011 11:10 PM" forState:UIControlStateDisabled]; [buttonTime

Doesn't work EditText padding in the API 21

烂漫一生 提交于 2019-12-03 05:56:41
Doesn't work EditText padding in the API 21. I try to do it in empty project, only with single editText, but it still doesn't work. Set padding programmatically works, but in my work project, I've a lot of EditTexts with different paddings and set padding programmatically isn't right way. On API level 19 xml padding works well. Are there any solutions? This my EditText xml code: <EditText android:id="@+id/et_text" android:text="Text" android:paddingLeft="20dp" android:paddingStart="20dp" android:paddingRight="20dp" android:paddingEnd="20dp" android:layout_marginLeft="30dp" android:layout

【Swift】UILabel 设置内边距

余生颓废 提交于 2019-12-03 05:54:23
【Swift】UILabel 设置内边距 前言   对应一个曾经开发 Android 的人来说,没有这些基础属性简直令人发指,还是表喷这个,认真写代码 - - # 声明   欢迎转载,但请保留文章原始出处:)   博客园:http://www.cnblogs.com   农民伯伯: http://over140.cnblogs.com 正文 class UILabelPadding : UILabel { private var padding = UIEdgeInsetsZero @IBInspectable var paddingLeft: CGFloat { get { return padding.left } set { padding.left = newValue } } @IBInspectable var paddingRight: CGFloat { get { return padding.right } set { padding.right = newValue } } @IBInspectable var paddingTop: CGFloat { get { return padding.top } set { padding.top = newValue } } @IBInspectable var paddingBottom: CGFloat {

Extra padding on Chrome/Safari/Webkit — any ideas?

隐身守侯 提交于 2019-12-03 05:02:44
My page has this extra padding on the top of page that I'm unable to remove. Tried everything under the sun and hope someone can show me the way. Any ideas? Your page has an element near the top with a top-margin that extends outside your page wrapper. If you have this: <div class="wrapper" style="margin: 0"> <div class="section" style="margin: 40px 0"> Stuff! </div> </div> Then the .section element will be positioned at the top of the .wrapper and its 40px margin will extend out the top. This has to do with the way margins collapse together so that two margins between elements don't