100% DIV width is not really 100%
The 100% value is 100% of the parent’s width or the view port. See the documentation.
The 100% value is 100% of the parent’s width or the view port. See the documentation.
To have buttons in rows where buttons are the same size you need to do. <LinearLayout android:orientation=”horizontal” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <Button android:layout_weight=”1″ android:layout_height=”wrap_content” android:layout_width=”0dip”/> <Button android:layout_weight=”1″ android:layout_height=”wrap_content” android:layout_width=”0dip”/> </LinearLayout> And fill in the other xml properties for your buttons. The magic is in the layout_weight and width properties. You don’t need the Table layout. These properties … Read more
Using the width function: $(‘div#somediv’).width(‘70%’); will turn: <div id=”somediv” /> into: <div id=”somediv” style=”width: 70%;”/>
I set width as max-content and it worked for me. width: max-content;
If you already have a reference to the DOM element, element.getBoundingClientRect will get you the values you want. The method has existed since Internet Explorer 4, and so it’s safe to use everywhere. However, the width and height attributes exist only in IE9+. You have to calculate them if you support IE8 and below: var … Read more
One option which is what I did is to extend LinearLayout and override the onMeasure function. For example: public class BoundedLinearLayout extends LinearLayout { private final int mBoundedWidth; private final int mBoundedHeight; public BoundedLinearLayout(Context context) { super(context); mBoundedWidth = 0; mBoundedHeight = 0; } public BoundedLinearLayout(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = … Read more
Just specify max-width: 100% alone, that should do it.
The body element has some margins by default. Unless you remove them, any element that you put inside, no matter it’s width (unless it’s in position absolute I think) will have some borders. They aren’t borders, but the gab in between the end of your element and the side of the body. Try this : … Read more
On iPhone OS it is slightly different, instead look at the NSString UIKit Additions Reference. The idea is the same as in Cocoa for Mac OS X, but there are more methods. For single lines of text use: – (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode And for multiline texts use: – (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(UILineBreakMode)lineBreakMode The use … Read more
New way I’ve just stumbled upon: css calc(): .calculated-width { width: -webkit-calc(100% – 100px); width: -moz-calc(100% – 100px); width: calc(100% – 100px); } Source: css width 100% minus 100px