height interview questions
Top height frequently asked interview questions
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 I set the height my wrapper div to be 100% minus the 60 px?
<div id="header"></div>
<div id="wrapper">
<div id="left"></div>
<div id="right"></div>
</div>
Source: (StackOverflow)
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?
Source: (StackOverflow)
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 type) {
super(context);
........
}
..................
.................
}
I have added the view in a tablerow using addview()
. It is working fine. Now I want to set height and width for the GraphView
. How to do that?
Source: (StackOverflow)
How do you get the rendered height of an element?
Lets say you have a <div>
element with some content inside. This content inside is going to stretch the height of the <div>
. How do you get the "rendered" height when you haven't explicitly set the height. Obviously, I tried:
var h = document.getElementById('someDiv').style.height;
Is there a trick for doing this? I am using jQuery if that helps.
Source: (StackOverflow)
I am trying to set a <div>
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 <!DOCTYTPE html>
however, it works, the <div>
taking up the whole page as desired. I want the page to validate, so what should I do?
I have this CSS on the <div>
, which has an ID of page
:
#page {
padding: 10px;
background-color: white;
height: 90% !important;
}
Source: (StackOverflow)
I want to make body have 100% of the browser height. Can I do that using CSS?
I tried setting height: 100%
, but it doesn't work.
I want to set a background color for a page to fill the entire browser window, but if the page has little content I get a ugly white bar at the bottom.
Source: (StackOverflow)
Let's say that a web page is twice the height of the browser window (thus there's a scroll bar). How do I retrieve the height of the web page in jQuery?
Source: (StackOverflow)
I have a layout with two columns - a left div
and a right div
.
The right div
has a grey background-color
, and I need it to expand vertically depending on the height of the user's browser window. Right now the background-color
ends at the last piece of content in that div
.
I've tried height:100%
, min-height:100%;
etc.
Source: (StackOverflow)
For example:
<iframe name="Stack" src="http://stackoverflow.com/" width="740"
frameborder="0" scrolling="no" id="iframe"> ...
</iframe>
I want it to be able to adjust its height according to the contents inside it, without using scroll.
Source: (StackOverflow)
I've seen this question asked in a couple other contexts on SO, but I thought it would be worth asking again for my particular case. I'm trying to create some re-usable CSS classes for more consistency and less clutter on my site, and I'm stuck on trying to standardize one thing I use frequently.
I have a container div that I don't want to set the height for (because it will vary depending on where on the site it is), and inside it is a header div, and then an unordered list of items, all with CSS applied to them. It looks a lot like this:

I want the unordered list to take up the remaining room in the container div, knowing that the header div is 18px tall. I just don't know how to specify the list's height as "the result of 100% minus 18px". Does anyone have any advice in this situation?
Source: (StackOverflow)
This question already has an answer here:
Is it possible to set same height as width (ratio 1:1)?
Example
+----------+
| body |
| 1:3 |
| |
| +------+ |
| | div | |
| | 1:1 | |
| +------+ |
| |
| |
| |
| |
| |
+----------+
CSS
div {
width: 80%;
height: same-as-width
}
Source: (StackOverflow)
I was myself searching for a simple solution to change the height of an iframe with the content in it.
It seems like the rules are that you can't get the height of the iframe from the page holding it. This is because of security apparently. How can we do this?
Source: (StackOverflow)
I've been using the accepted answer here for years.
On iOS 7, the contentSize.height becomes the frame.height-8, regardless of text content.
What's a working method to adjust the height on iOS 7?
Source: (StackOverflow)
I would assume this is possible, but i just cant figure it out..
i have a site thats basic structure is set up as follows.
<div id="header"></div>
<div id="main">
<div id="navigation"></div>
<div id="content"></div>
</div>
<div id="footer"></div>
The navigation is a left hand navigation with a content div to the right of it. I would like to scale the navigation vertically to be the same height as the content div depending on what is loaded into the content div. the information for the content div is pulled in through PHP, so it is different every time. anyway long story short. Is there a way to set it so that my navigation will always be the full height of the content div no matter which page is loaded?
Source: (StackOverflow)