Solved

position panel inside a div

Posted on 2009-05-09
3
602 Views
Last Modified: 2012-05-06
Is it possible to position a panel inside a div programmatically.  For example, I have a div with the height of the div set using css.  The content in the panel does not fill the content of the containing div, but I want to position the panel (anchor) to the bottom right of the div.

I'm using a percentage for the height in the containing div, which does not seem to work with the relative/absolute positioning using css because depending on the screen size the position changes.  Therefore I can't use pixels to position.

I know a table layout can kind of accomplish this, but I need to use divs that is semantically correct.  Is this possible?

Thank you.
|-------------------------------|
|                               |
|         div                   |
|                               |
|                   |-----------|
|                   |  panel    |
|                   |           |
|-------------------|-----------|

Open in new window

0
Comment
Question by:-Dman100-
  • 2
3 Comments
 
LVL 10

Expert Comment

by:cdebel
ID: 24344787
I don't know if it work, but i would try something like this

<div style="vertical-align:bottom;" align=right></div>
0
 
LVL 6

Accepted Solution

by:
hehdaddy earned 500 total points
ID: 24344879
Hi there,

If your containing DIV has position:absolute, then your panel can use position:absolute with a bottom: 0 and right: 0

Like this messy example:
<div style="width:50%; height: 40%; border: solid 1px Red; position:absolute;">
    
    <asp:Panel ID="p1" runat="server" style="position:absolute; bottom:0; right:0; border: solid 1px Green; height:20%; width:10%">Test</asp:Panel>
    <br /><br /><br /><br />
    </div>

Open in new window

0
 
LVL 10

Expert Comment

by:cdebel
ID: 24344889
hehdaddy is right.  Forget what i said.  I just noticed that all my content in the div would be right aligned and that's probabl not what you want.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET MVC -Add authentication 2 21
Under active page on navigation bar 8 14
How come this regular expression allows "e"? 14 38
Else condition 9 19
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question