Questions tagged [width]

The property which determines the size of an object on the X-axis. The most common form of this measurement is in pixels or millimeters.

The property which determines the size of an object on the X-axis. Most likely, it has no taxonomic value in your post, and you should not be using it. Consider e.g. , or

6050 questions
218
votes
10 answers

Canvas is stretched when using CSS but normal with `width` & `height` attributes

I have 2 canvases, one uses HTML attributes width and height to size it, the other uses CSS:
Sirber
  • 3,358
  • 5
  • 25
  • 32
175
votes
10 answers

Android set height and width of Custom view programmatically

I have created a custom view named Graphview . Here is the structure for the GraphView class. public class GraphView extends View { public GraphView(Context context, float[] values, String title, String[] horlabels, String[] verlabels, boolean…
dev_android
  • 8,698
  • 22
  • 91
  • 148
170
votes
12 answers

Make an image width 100% of parent div, but not bigger than its own width

I’m trying to get an image (dynamically placed, with no restrictions on dimensions) to be as wide as its parent div, but only as long as that width isn’t wider than its own width at 100%. I’ve tried this, to no avail: img { width: 100%; …
Alfonso
  • 2,166
  • 3
  • 16
  • 15
147
votes
14 answers

Width equal to content

I'm experiencing some trouble with the width property of CSS. I have some paragraphs inside a div. I'd like to make the width of the paragraphs equal to their content, so that their green background looks like a label for the text. What I get…
user3067088
  • 1,869
  • 4
  • 17
  • 19
146
votes
8 answers

Width ignored on flexbox items

http://jsfiddle.net/XW9Se/ I've set width: 200px; on the left
but if I view it with the browser inspector tool it appears that the real width is random or something. It keeps changing depending on the window size. Why doesn't the width take…
Alex
  • 66,732
  • 177
  • 439
  • 641
145
votes
8 answers

Override and reset CSS style: auto or none don't work

I would like to override following CSS styling defined for all tables: table { font-size: 12px; width: 100%; min-width: 400px; display:inline-table; } I have specific table with class called 'other'. Finally…
sergionni
  • 13,290
  • 42
  • 132
  • 189
138
votes
5 answers

IE 8: background-size fix

I've tried to add background size to IE but it's not working at all: HTML

Notícias

CSS: div#content h2#news { background: url('../images/news-background.jpg') no-repeat; …
Thomas
  • 1,381
  • 2
  • 9
  • 4
136
votes
15 answers

How to make a div with no content have a width?

I am trying to add a width to a div, but I seem to be running into a problem because it has no content. Here is the CSS and HTML I have so far, but it is not working: CSS body{ margin:0 auto; width:1000px } ul{ width:800px; } ul…
runeveryday
  • 2,751
  • 4
  • 30
  • 44
132
votes
8 answers

How to get screen width without (minus) scrollbar?

I have an element and need it's width without(!) vertical scrollbar. Firebug tells me body width is 1280px. Either of these work fine in Firefox: console.log($('.element').outerWidth() ); console.log($('.element').outerWidth(true) ); $detour =…
frequent
  • 27,643
  • 59
  • 181
  • 333
129
votes
15 answers

td widths, not working?

So I have this code here:
user979331
  • 11,039
  • 73
  • 223
  • 418
126
votes
3 answers

iPad browser WIDTH & HEIGHT standard

Does anyone know the safest width and height for the BODY when viewing any web page on the iPad? I want to avoid the scrollbars as much as possible. Thanks. Erik
Erik
  • 5,701
  • 27
  • 70
  • 119
118
votes
9 answers

Display block without 100% width

I want to set a span element to appear below another element using the display property. I tried applying inline-block but without success, and figured I could use block if I somehow managed to avoid giving the element a width of 100% (I don't want…
Staffan Estberg
  • 6,795
  • 16
  • 71
  • 107
118
votes
10 answers

Expand div to max width when float:left is set

I have something like that:
menu
content
both floats are neccesary. I want the content div to fill the whole screen minus those 100px for the menu. If i dont use float the div…
Flo
  • 1,445
  • 2
  • 10
  • 12
116
votes
8 answers

Getting terminal width in C?

I've been looking for a way to get the terminal width from within my C program. What I keep coming up with is something along the lines of: #include #include int main (void) { struct ttysize ts; ioctl(0, TIOCGSIZE,…
austin
  • 1,289
  • 4
  • 11
  • 10
114
votes
12 answers

jQuery - Get Width of Element when Not Visible (Display: None)

It seems like in jQuery when an element is not visible width() returns 0. Makes sense, but I need to get the width of a table in order to set the width of the parent before I show the parent. As noted below, there is text in the parent, that makes…
Martin
  • 11,031
  • 8
  • 50
  • 77