I have created a webpage with Header and Footer and want to make div in the middle of header and footer such that suppose the height of the mid div is 500 and content in the div let say,6-7 images having more height , so it will overlap to footer.
Now what i want is that i want div to automatically increases the size without overlapping with footer when images are added footer automatically shift downward n div increases its size automatically.
In principle this doesn't have anything to do with C# but all with HTML and CSS. If you don't set a fixed height on the mid DIV but instead use a minimum height this should work automaticaaly. It is hard to say for sure without seeing you HTML and CSS but
it should work. See this:
http://www.w3schools.com/cssref/pr_dim_min-height.asp
var height=$('.content').height(); //here .content refer the class name. suppose you are used Id means you have to call like this '#content' $(".content").css("height",height+20);
//add 20px height to actual height so you will get some more space between content and footer. }); </script>
richagulati
Member
12 Points
2 Posts
How to create dynamic div in C# ?
Feb 20, 2012 04:12 PM|LINK
I have created a webpage with Header and Footer and want to make div in the middle of header and footer such that suppose the height of the mid div is 500 and content in the div let say,6-7 images having more height , so it will overlap to footer.
Now what i want is that i want div to automatically increases the size without overlapping with footer when images are added footer automatically shift downward n div increases its size automatically.
please rply.
thnx
Yorrick vd V...
Participant
1674 Points
301 Posts
Re: How to create dynamic div in C# ?
Feb 20, 2012 04:22 PM|LINK
Hi,
In principle this doesn't have anything to do with C# but all with HTML and CSS. If you don't set a fixed height on the mid DIV but instead use a minimum height this should work automaticaaly. It is hard to say for sure without seeing you HTML and CSS but it should work. See this: http://www.w3schools.com/cssref/pr_dim_min-height.asp
An example CSS of how I use this below:
#OuterContainer {width:760px; border:solid 0px #000; margin:auto; background-image:url(../interface/ContainerBackground.png); background-repeat:repeat-y} #InnerContainer {width:752px; border:solid 1px #000; margin: 0 auto;} #Header {height:79px; background: url('../interface/header.jpg')} #NavBar {height:18px; border-top: solid 1px orange; border-bottom:solid 1px orange; margin-top:1px} #Content {margin:5px; min-height:400px;} #ContentContainer {margin-top:20px} #Footer {height:79px; background: url('../interface/Footer.jpg') no-repeat; clear:left; position:relative}And the HTML:
<form id="form1" runat="server"> <div> <div id="HeaderText"></div> <div id="OuterContainer"> <div id="InnerContainer"> <div id="Header"> </div> <div id="NavBar"> <uc:MainMenu id="MainMenu" runat="server"></uc:MainMenu> </div> <div id="Content"> <asp:ContentPlaceHolder ID="MainContent" runat="server"> </asp:ContentPlaceHolder> </div> <div id="Footer"> <span id="Copyright">© 2010 Yorrick</span> </div> </div> </div> <div id="Bottom"></div> </div> </form>The Content div has the min height in this.
Hope this helps.
Regards,
Yorrick
&
Don't forget to click "Mark As Answer" on the post that helped you.
jorame22
Member
62 Points
19 Posts
Re: How to create dynamic div in C# ?
Feb 21, 2012 02:45 AM|LINK
Can you post your code so we can get a better picture of what you are trying to accomplish here???
arunabathan
Member
730 Points
236 Posts
Re: How to create dynamic div in C# ?
Feb 21, 2012 03:59 AM|LINK
hi,
use jquery to find the height of div..
In Design page
Add this Script. before that you have to call jquery library function. thats you will get here
Thanks&Regards,
Arunabathan.G
(Please mark If you got ANSWER)
richagulati
Member
12 Points
2 Posts
Re: How to create dynamic div in C# ?
Feb 21, 2012 06:57 AM|LINK
thank you for taking interest in my query.
But the problem is resolved.
thnx again.
Smith Peter
Member
142 Points
52 Posts
Re: How to create dynamic div in C# ?
Feb 22, 2012 04:34 AM|LINK
Hi,
CAn you please provide the solution that you used? So other can get the solution.