.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

height of fixed height div appears to vary depending on content

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :ASP.Net
why would text content of a fixed height div with a background image push the background image down and make the div higher? In the following, without the "overflow:hidden;" the div draws with a height > 180px. And the background image starts lower vertically than it does when there is not <h1> text content or when overflow:hidden. Also, when I put a border around the div (  border: 1px solid black ), the background image snaps back up to the top, with the <h1> text overlaying it as I want it to. <div style="background-image:url('images/green city header.png');              background-repeat:no-repeat;       background-position:left bottom;        height: 180px;"><h1>efg</h1></div> The text content is not overflowing. And even if it did, why would overflow text increase the height of a container?Same behavior in IE8 and Chrome. thanks,  

View Complete Post

More Related Resource Links

How to find the content height of the Flow document?

Hi Dudes, I have a RichTextBox control in my application. When the user types the content inside the RichTextBox and clicks ok i need to validate such that the content that the user entered should not overflow the controls Height. So i need to find the height of the FlowDocument property of the RichTextBox Control. I dont have an option to find the height found one way from surfing around        double GetDocumentHeight()         {             Rect rectStart = Document.ContentStart.GetCharacterRect(LogicalDirection.Forward);             Rect rectEnd = Document.ContentEnd.GetCharacterRect(LogicalDirection.Forward);             if (!Double.IsInfinity(rectEnd.Bottom) && !Double.IsInfinity(rectStart.Top))             {                 return rectEnd.Bottom - rectStart.Top;             }             else             {        

CSS Layout Problem when height is fixed to 100%

Hi all,I'm using 3 column DIV layouts for my aspx page which i downloaded it from james tyler website.My problem is when i set height of all the div layers to some 750px it is looking good and when i remove the height, all the DIV layers are getting shortened and looking awakward.I mean if the left menu DIV contains only 3 items, the whole div's height is being reduced to fit those only 3 menu items. I need to maintain 100% height for all DIV layers and my DOCTYPE is XHTML1.0 STRICT. Can anyone please help me out as i'm stuck here.. Here is my CSS and Markup:/* Header styles */ #header { clear:both; float:left; width:100%; } #header { border-bottom:1px solid #57B6DD; } #header p, #header h1, #header h2 { padding:.4em 15px 0 15px; margin:0; } #header ul { clear:left; float:left; width:100%; list-style:none; margin:10px 0 0 0; padding:0; } #header ul li { display:inline; list-style:none; margin:0; padding:0; } #header ul li a { display:block; float:left; margin:0 0 0 1px; padding:3px 10px; text-align:center; background:#eee; color:#000; text-decoration:none; position:relative; left:15px; line-height:1.3em; } #header ul li a:hover { background:#369; color:#fff; } #header ul li a.active, #header ul li a.active:hover { color:#fff; background:#000; font-weight:bold; } #header ul li a span { display:block; } /* 'widths' sub menu */

Want to page content based off of a character limit or height of container

First of all I would like to say hello. I have created a backend that allows me to update my site content. I am using fckeditor to pull the data from my table in the database. The problem I am having is this:  I need to create paging of content so that when the height restriction is met a next btn or numbering system displays to allow the user to click to the next page of content. Can anyone point me in the right direction or possible tell me how I can do this?

fixed widht height rows master page


Hi all:
I have a master page with three rows. What i want is that header should be fixed to top. Footer should always be fixed to bottom and center area should have a vertical scroll (top to bottom ) only if the contents size increases. and it should look same on all resolution. What should be style sheet for body and rows. I read somehwere that I need to use div. I used it for scrolling but it shrinks/expands with resolution.
    font-family: Ver

New window with width and height identitical to the page content


hi all forum

I have my NewsDetails.aspx page which displays a certain news  in a gridview according to the NewsId query string field. i wish to make the user able to print the page or mail it to a friend  so I used the following code

protected void ArticleGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        if (e.CommandName == "print")
            int NewsId = int.Parse(e.CommandArgument.ToString());
            string url = "ForPrint.aspx?NewsId=" + NewsId;
            string js = "<script language='JavaScript'>window.open('" + url + "','" + ArticleLbl.Text + "',";
            js += "'top=0,left=0,status=no,width=710,height=700,resizable=no,scrollbars= yes');";
            js += "</script>";
            ClientScript.RegisterClientScriptBlock(this.GetType(), &

How can I set web parts to always be a specified fixed width and height?

Is that possible? I don't want their size to be changed.

Calculate Client Height in javascript

The article Calculate Client Height in javascript was added by amoljk2009 on Monday, May 31, 2010.

Hi, Following code will help the developer to calculate exact client height in all browsers.script language="javascript" type="text/javascript">var winW = 630, winH = 460;if (parseInt(navigator.appVersion)>3) {if (navigator.appName

determine the screen height within javascript and set a property on an iframe


I have a webform  that has a header and iframe,  what I need to do is on load detemine the users screen height and then  set the height on the iframe. Can someone explain  or show me an example of how to do this.

Thanks in advance.

IE Process Start and Window Height

Hi, I'm working on a tool for cross-browser testing: the idea being that a WinForms app will open a range of URLs over a range of browsers, and save each out as a screenshot. I have a problem with Internet Explorer though - namely that the opened window thinks it's a lot larger than it actually is... Background: I've got some javascript/jQuery, that happily reads a parameter from a URL, and scrolls a page down - so for example http://mypage/?scroll=1 will show the top part of a web page, http://mypage/?scroll=2 shows the second part, and so forth. The scrolling mechanism uses $(window).height() and $(document).height() - both of which are standard javascript methods that work happily.   $(document).ready(function () { var windowHeight = $(window).height(); var documentHeight = $(document).height(); alert("Window Height: " + windowHeight + "px, Document Height: " + documentHeight + "px" ); });   If I open my url in IE normally, it picks up (for example) a window height of 880px - which is correct since my screen is 1050px high, minus a bit for the IE toolbars/furniture. In my WinForms application, I can open IE happily with one of the scrollable urls - namely   process.StartInfo.CreateNoWindow = false ; process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; process.StartInfo.FileName = "iexpl

How to Fix the Details Section Height

Dear Fren's , I have an issue while working with a Crystal Report 10.0 I am printing a Students records in a pre-define format. now the detail section is dymaically change beacuse of No. of records for the students for some students there are 8 record ,& for some other students  only 2 records are their because i am printing on pre defined format when 2 records comes in the details section it is placing the reords at wrong places i want to fix the detail section either for 8 or for 2 records . how can i do this , please help Thaks in advance

Full desired height of a RichTextBox control?

I don't mean the control's .Height property... ...I have a WinForm with a RichTextBox control, and another control underneath the RichTextBox control.  The RichTextBox control is anchored on the left, top, and right sides, so the width is automatically resized as the parent form is resized.  (it also has its Multiline and and WordWrap properties set to True) The item underneath the RichTextBox needs to always be right underneath it (little whitespace), and the RichTextBox needs to always display its entire text (nothing hidden). As I get the form's resize event, I'd like to update the RichTextBox's hight so all text is displayed, however I'm not seeing any properities or methods which would be helpful.  There is the PrefferredHeight property, but it is always returning 13. Basically, it comes dowen to this: when WordWrap is set to true, is there a way to see what the desired height is?  Or is there a way to see if any of the text is clipped? If not, I suppose my next step would be to roll my own custom control and draw the text myself, keeping track of the autowrap and line count, but I thought I'd post a message here first and see if anyone has a better idea. Thanks, Jeff      

Dynamically change the page footer height

Hi, I want to dynamically change the page footer height based on a condition? Is that possible?   Thanks in Advance  

Getting full font height

How I can get full font height (height of system caret in TextBox or RichTextBox control when Font property is set to particular font) in pixels? I have tried Graphics.MeasureCharacterRanges and Graphics.MeasureString functions, but result is not equal caret height. It's terrible! A have also tried Win32 API function GetTextMetrics. Can someone help me?

SSRS 2008 group footer totals on a new page has a non-expected large cell height

SSRS 2008 group footer totals on a new page has a non-expected large cell height. When the group total is the first component on a new page, then this happens, but when it is part of the group on but not the first component, then it reverts to normal cell height. I have played with the advance settings now for hours, but cannot get this to work. Any ideas?  

problem with update panel height

I am using ajax update panel to show a tree without postback there is a label that is at the top of the panel I am hiding the label while showing the tree. document.getElementById('ctl00_phldDialogBody_lbltext').style.display = "none"; in the javascript but even after hiding the space of the label is still left blank causing the tree to be moved down pls help to fix it i want the tree to be at the same position

How do I change the height of a remote iframe

<iframe id="hdnFrm" name="hdnFrm" src=""   scrolling="yes" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="width:90%;height:90px"></iframe>   here is my iframe. This in on a php page on a different website. Right below the iframe is a form. The form posts variables to a page on my vb.net website. The codebehind processes the data in the form. The results of processing are sent back to the iframe above. When this happens instead of the height beinc 90px, I want to change it to a different number. How can i do this? Do I set up some type of "listener" for when the controls arrive? I read this somewhere.   

WPF control size is larger than explicitly set width and height values.

I created a Canvas with fixed Width and Height (256x256). Next to it I put an Image control displaying a 256x256 texture without stretching. How is it possible that actual sizes of both controls on the screen differ so much? Here - is the screenshot illustrating size mismatch. And here - the TestLines256.png in case someone liked to check it (and maybe point out that I'm stupid and this texture is 180x180 and not 256x256 as I claimed). XAML with creation of the controls:   <Window x:Class="OversizedQuad.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" SizeToContent="WidthAndHeight"> <StackPanel Orientation="Horizontal"> <Canvas Width="256" Height="256" Background="Red" /> <Image Stretch="None" Source="TestLines256.png" /> </StackPanel>
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend