Positioning a div towards the bottom right corner of another element

I have two divs nested inside another div. One of them is a table displaying a list of items that can be updated by entering text into a textbox positioned next to it. I am struggling to position the textbox in the bottom right corner despite trying various methods such as floating and positioning. The first image shows the current layout, while the second image illustrates how I want it to look.

ASP.NET code:

<asp:Content ID="Content1" ContentPlaceHolderID="PrimaryContentPlaceHolder" runat="Server">
<%--<div style="margin-bottom: 20px; width: 300px;">--%>
    <table class="Grid" style="width:300px;float:left; margin-right:10px;" >
        <tr>
            <th>
                Banned Domains
            </th>
            <td runat="server" id="bannedDomains">
            </td>
        </tr>
    </table>
   <%-- </div>--%>
<div style="position:relative; bottom:0px;">
    <asp:TextBox ID="bannedDomainText" runat="server" Rows="5" TextMode="SingleLine"
        Width="150px" Height="19px" />
    <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" style="padding: 2px 5px 2px 5px;" PostBackUrl="~/admin/bespoke/Green-FreeShipping.aspx"
        Text="Add to List" />
</div>
</asp:Content>

css:

    #Content table
{
border-collapse: collapse;
}

#Content table.Grid 
{
width: 100%;
clear: both;
margin: 12px 0 12px 0;
}

#Content table.Grid th, #Content table.Grid td
{
background-color: White;
border-top: 1px solid #cccccc;
padding: 2px 6px 2px 6px;
}

#Content table.Grid th
{
background-color: #f5f5f5;
}

#Content table tr:hover td
{
background: #f9f9f9;
}

Answer №1

Check out this example to see how it works:

View Demo

Cascading Style Sheets (CSS)

.Grid {
    border: 1px solid #ff0000;
    height: 400px;
    width:300px;
    position: relative;
}

div.wrapper {
    position: relative;
    display: inline-block;
}

textarea {
    position: absolute;
    bottom: 0;
    right: -200px;
}

HTML

<div class="wrapper">
<table class="Grid">
    <tr>
        <th>
            Banned Domains
        </th>
       <td runat="server" id="bannedDomains"></td>
    </tr>
</table>
<textarea></textarea>
</div>

Answer №2

Check out this method: http://example.com/123456

<div class="left-section">LEFT</div>
<div class="right-section"><div>RIGHT</div></div>

.left-section {
width:150px;
height:150px;
background:#f0f0f0;
float:left;
margin-right:20px;
}
.right-section {
width:200px;
height:200px;
background:#ccc;
float:left;
position:relative;
}
.right-section div {
width:180px;
position:absolute;
bottom:10px;
background:blue;
}

Answer №3

Check out this demo: http://jsfiddle.net/nobuts/WzUjr/

<div class="container">
    <div class="columns"><div id="table">div/table</div></div>
        <div class="columns"><div id="textbox">div/textbox</div></div>
    <br style="clear:both">
</div>

.container{
    background-color: red;
    color: black;
    height: 250px;
    padding: 5px;
}

.columns{
    height: 240px;
    float: left;
    margin: 5px;
    position: relative;
}
#table{
    background-color: #ff9900;
    height: 100%;
    width: 250px;
}
#textbox{
    background-color: #ff9900;
    bottom: 0px;
    height: 30px;
    top: auto;
    position: absolute;
    width: 100px;
}

Answer №4

One issue that arises is when the float:left property remains attached to the <table> element without moving. Here's a solution:

  1. Insert a
    <div style="clear:both;"></div>
    immediately after the <table> tag (even if it's blank).
  2. Take out the float from the table and adjust its positioning accordingly.

I hope this resolves the problem :-)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to Implement Filtering in AngularJS ng-repeat

While developing my app, I came across a challenge with the filter in my ng-repeat. Initially, I could search by productCode or name. Then, a new requirement emerged - "Filter by SubcategoryId." The issue lies in filtering strictly by subCategoryId, while ...

"Exploring the Dynamic Duo of AngularJS ngAnimate and animate.css

I've been working on getting my animation to function correctly with AngularJS and animate.css. In order to achieve this, I set up the SASS in the following way: .slide-animate { &.ng-enter, &.ng-leave{ } &.ng-enter { ...

Is there a way to smoothly incorporate a new animation into a page, while ensuring that existing elements adjust to make room for it?

I am looking to smoothly fade and move a hidden element (display:none) within the page, shifting other elements to animate into their new positions as necessary. When I reveal the hidden element by changing it to "display:initial," it should seamlessly a ...

Clicking on Google Code Prettify does not trigger syntax highlighting

I utilize Google Code Prettify for syntax highlighting my code. Below is the HTML snippet I use: <head> <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> </head> <body> ...

A bottom border that spans the entire width, complete with padding

I am attempting to create a uniform border for each item on my list. However, due to the nested structure of the list, I have used padding to achieve this. As a result, the appearance is as expected and behaves normally. https://i.sstatic.net/cHNb3.png ...

Create an additional column in HTML using Bootstrap styling

I am currently working on a CRUD form (using PHPMyAdmin for the database), developed in HTML, JavaScript, and PHP. The queries are executed using jQuery. I am facing an issue with my code - whenever I add a new column to my table, the formatting gets messe ...

Replace minor components (SVG) within the primary SVG illustration

I'm interested in transforming SVG elements into the main SVG element. For example, let's say the black square represents the main SVG element. I want to change elements 1, 2, and 3 to different SVG elements using JavaScript code. However, I am u ...

Chrome clip-path creates a white horizontal line shape that resembles a paperclip

Having an issue with horizontal white lines appearing through a div with clip-path set and background image in Chrome. Any suggestions on how to fix this? Check out the screenshot for reference: Screenshot showing the horizontal white line bug If you nee ...

Having trouble retrieving an image from a folder after deploying the web application

While developing a basic Web Application using NetBeans, I encountered an issue with accessing an image. No matter where I placed the image in the directory structure, it remained inaccessible unless it was in the same location as my index.xhtml file. I a ...

The system is unable to add a duplicate key to the 'dbo.Zoopla' object, as the key value (35268380) already exists

After receiving assistance for my CSV import question, I realized that the presence of commas in my address data was causing issues with the columns. Although I have fixed this issue, there seems to be a problem with one entry in the CSV file where it iden ...

What is causing the background image CSS to malfunction?

I'm having trouble figuring out why the egg image isn't displaying. Here is the code that's being used: .header { background: linear-gradient(180deg, rgba(0, 0, 0, 0.92), rgba(54, 54, 54, 0.5) 39.24%, rgba(28, 28, 28, 0.4)), u ...

The li::before pseudo element isn't working properly

I am having issues with my UL list where the CSS class I applied is not affecting the li::before pseudo class. Here's the HTML: <ul class="my-ul"> <li>Item 1</li> <li>Item 2</li> </ul> This is the CSS I a ...

How does GitHub create their unique "character portraits" for optimized web performance?

Have you ever noticed that the small images on Github are actually characters instead of traditional image files? Let's take the small person image that is used when assigning someone to an issue as an example. When you hover over the small person ima ...

What is the best way to implement the navbar toggler feature in a Bootstrap dashboard?

Currently, I am in the process of developing an Admin Panel using the Bootstrap Material Dashboard provided by Creative Tim. Although everything has been set up correctly, there seems to be an issue when viewing the panel on smaller screens. The navbar to ...

Are tabs best displayed as an overlay?

I've been searching high and low for a tutorial on how to create an overlay with tabs similar to the Google Chrome webstore. If anyone knows of a tutorial or a combination of tutorials that can help me achieve this, please let me know! Link Any guida ...

What is a straightforward method to showcase prototype nodes in PHP?

It's like a different flavor of UI, function DisplayUI($elements) { } This function will display the specified elements with name, id, and type in a flexible manner. UPDATE Create an array and get HTML as output. Has anyone experimented with thi ...

When HTML elements are unable to access functions defined in separate JS files

After successfully resolving the issue, I am still curious as to why the initial and second attempts did not work: The problem lay with an HTML element connected to an event (myFunction()): echo '<button class="btn remove-btn" onclick="myFunction( ...

CSS - Issue with a blurred div nested inside another blurred div

I'm facing an issue where I can't have a blurred element inside another blurred element. Currently, I have a header with backdrop-filter: blur(3px); and a div within it with a more intense background blur of backdrop-filter: blur(50px);. However, ...

Display or hide an image in Angular when a button is clicked

I am facing an issue in my code where I want to show and hide an image through a link when a button is clicked. Currently, when I click the button, the image opens in a new tab in Chrome instead of displaying it on my app's page. I need to link the UR ...

Changing JSon to dynamic object in VB.Net

Currently, I am working with VB.Net and utilizing the Salesforce API. The API is returning a less than appealing JSON structure that I am having difficulty deserializing. Below is the code snippet I am using with JSON.Net. Dim objDescription As Object = J ...