Questions tagged [height]

The property which determines the size of an object on the Y-axis. Please don't use this tag, it has no taxonomic value in your post.

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

6209 questions
221
votes
15 answers

CSS: 100% width or height while keeping aspect ratio?

Currently, with STYLE, I can use width: 100% and auto on the height (or vice versa), but I still can't constrain the image into a specific position, either being too wide or too tall, respectively. Any ideas?
Weston Watson
  • 5,344
  • 6
  • 24
  • 25
221
votes
11 answers

CSS How to set div height 100% minus nPx

I have a wrapper div which contans 2 divs next to each other. Above this container I have a div that contains my header. The wrapper div must be 100% minus the height of the header. The header is about 60 px. This is fixed. So my question is: how do…
Martijn
  • 24,441
  • 60
  • 174
  • 261
220
votes
7 answers

Percentage Height HTML 5/CSS

I am trying to set a
to a certain percentage height in CSS, but it just remains the same size as the content inside it. When I remove the HTML 5 however, it works, the
taking up the whole page as desired. I want the page…
Ashley Strout
  • 6,107
  • 5
  • 25
  • 45
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
215
votes
16 answers

How to set Custom height for Widget in GridView in Flutter?

Even after specifying the height for Container GridView, my code is producing square widgets. class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState…
Ajay Kumar
  • 15,250
  • 14
  • 54
  • 53
176
votes
6 answers

How do I get the real .height() of a overflow: hidden or overflow: scroll div?

I have a question regarding how to get a div height. I'm aware of .height() and innerHeight(), but none of them does the job for me in this case. The thing is that in this case I have a div that is overflown width a overflow: scroll and the div has…
emilolsson
  • 2,008
  • 2
  • 14
  • 16
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
158
votes
9 answers

Make div (height) occupy parent remaining height

Consider the following HTML/css code sample:
Text
Text
Text
Text
Text
Text
#container { width: 300px; height: 300px; border:1px solid…
Alvaro
  • 9,247
  • 8
  • 49
  • 76
156
votes
4 answers

Twitter Bootstrap: div in container with 100% height

Using twitter bootstrap (2), I have a simple page with a nav bar, and inside the container I want to add a div with 100% height (to the bottom of the screen). My css-fu is rusty, and I can't work this out. Simple HTML:
154
votes
8 answers

Position: absolute and parent height?

I have some containers and their children are only absolute / relatively positioned. How to set containers height so their children will be inside of them? Here's the code: HTML
Foo
137
votes
13 answers

How to determine height of UICollectionView with FlowLayout

I've got an UICollectionView with an UICollectionViewFlowLayout, and i want to calculate its content size (for return in intrinsicContentSize needed for adjusting its height via AutoLayout). The problems is: Even if I have a fixed and equal height…
Jan Z.
  • 6,883
  • 4
  • 23
  • 27
131
votes
18 answers

Adjust UILabel height to text

I have some labels which I want to adjust their height to the text, this is the code I wrote for this now func heightForView(text:String, font:UIFont, width:CGFloat) -> CGFloat{ let label:UILabel = UILabel(frame: CGRectMake(0, 0, width,…
TheBurgerShot
  • 1,586
  • 2
  • 11
  • 20
121
votes
12 answers

UITableViewCell with UITextView height in iOS 7?

How can I calculate the height of an UITableViewCell with an UITextView in it in iOS 7? I found a lot of answers on similar questions, but sizeWithFont: takes part in every solution and this method is deprecated! I know I have to use -…
MyJBMe
  • 2,226
  • 4
  • 15
  • 21
106
votes
4 answers

jquery $(window).width() and $(window).height() return different values when viewport has not been resized

I am writing a site using jquery that repeatedly calls $(window).width() and $(window).height() to position and size elements based on the viewport size. In troubleshooting I discovered that I am getting slightly different viewport size reports in…
Manca Weeks
  • 1,143
  • 3
  • 11
  • 11
106
votes
8 answers

set height of imageview as matchparent programmatically

I need to set the height of an imageview as matchparent programatically.if it is a fixed height i know how to set. but how can i set it as matchparent? EDIT: actually height of the parent layout is dynamic.so i need to make the height of the…
andro-girl
  • 7,989
  • 22
  • 71
  • 94