Arranging Divs next to each other, ensuring uniform column heights, within a ContentPlaceHolder in ASP.NET

I am attempting to create a layout with three columns. The left and right columns will each contain a button that should remain aligned with the outer border of the container. In the center column, there will be an asp:Table generated dynamically, ranging from 1 row and 1 column to 6 rows and 7 columns.

I have tried to reference this CSS example, which led me to this site: http://www.alistapart.com/d/holygrail/example_3.html. While I have managed to get the divs to display side by side, I'm struggling to vertically align the left and right columns or make them equal in height with the center div tag, which may essentially be the same issue.

I am not certain if it is relevant, but my divs are within a ContentPlaceHolder on an ASP Page.

This is the code snippet:

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    //Container for the three columns
    <div id="calendarContainer">

        //Left button container
        <div id="navigateButtonLeft" class="calendarColumn">
            <asp:Button ID="btnLeftMonth" runat="server" Text="<" 
                        onclick="btnLeftMonth_Click" /> 
        </div>

        //Table/month-calendar container
        <div id="calendar"class="calendarColumn">
            <asp:Table ID="TableMonthCalendar" runat="server" GridLines="Both" />
        </div>

        //Right button container
        <div class="calendarColumn">
            <asp:Button ID="btnRightMonth" runat="server" Text=">" 
                        onclick="btnRightMonth_Click" />  
        </div>
    </div>
</asp:Content>

My probably futile attempt at CSS:

#calendarContainer {
  overflow:hidden;
  border: 1px solid black;
}
#calendarContainer .calendarColumn {
  padding-bottom: 1001em;
  margin-bottom: -1000em;
  border: 1px solid black;
  overflow:hidden;
  float:left;
}
#navigateButtonLeft {

}
#calendar {
  width: 80%;
}
#navigateButtonRight {

}

Initially, I employed a table structure with a tr and three tds, but it did not meet my requirements.

Below is a visual representation of my objective, which may clarify things better than my description:

Answer №1

To properly display a calendar with columns, you will need to use absolute positioning to control their placement and avoid any layout issues when adding more content:

Take a look at this Fiddle example!

For more information on this technique, visit these resources:

CSS Position Property | CSS-Tricks - Fluid Width Equal Height Columns

Additional Notes:

In the Fiddle, examine the css section to see how elements are positioned correctly. Using 'top' and 'bottom' properties allows elements to flow within their container, such as in your case, the container being #calendarContainer.


UPDATE:

Here is a second Fiddle Example with a main wrapper without specific coordinates.


UPDATED AGAIN

Check out another Fiddle Example demonstrating buttons styled as icons.

Icons Used:

Arrow Left | Arrow Right


LATEST UPDATE: BUTTONS ARRANGED TOP TO BOTTOM

View the updated Fiddle Here!

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

What is the solution for resolving the "cannot resolve" issue in CSS for an Angular project?

During a small project I was working on, I decided to add a background image to another image using CSS. Here is the code snippet: .child2 img { width: 200px; height: 200px; border-radius: 50%; background-image: url('./assets/images/imageb ...

Submitting a form with AJAX using JQuery in ASP.Net is made even easier when utilizing Master Pages for

After developing a search program with lucene.net, I encountered an issue where reloading the entire page was necessary to submit a new query. To resolve this, I explored implementing AJAX for seamless search submission, but have been facing difficulties i ...

The storage of HTML5 data is not being saved locally

<html> <head> <title></title> <style type="text/css"> body { font-family: tahoma; } h2 { font-weight: bold; border-bottom: 2px solid gray; margin-bottom: 10px; } #dat ...

Create a CSV document using information from a JSON dataset

My main goal is to create a CSV file from the JSON object retrieved through an Ajax request, The JSON data I receive represents all the entries from a form : https://i.sstatic.net/4fwh2.png I already have a working solution for extracting one field valu ...

Getting the location of a mouse click and adding tags (marks) on an image: a simple guide

Is there a way to incorporate images with tagged marks similar to Facebook's image tagging feature? How can I retrieve the X and Y coordinates of tags on the image itself (not the screen) and display them in a responsive manner? ...

Resize the shape of an image's polygon

Is there a way to independently scale a specific polygon of an image on hover? For example, I have a world map and I would like to enlarge a country when hovering over it, then return it to its original size when no longer hovering. I am familiar with us ...

Sending Data to a PHP Script

I attempted to use the code below to send values to another PHP page but I am not receiving any output. File: Send.html <form id="form1" action="get.php" method="get"> <input name="search_name" type="text" id="search_name" size="20.5" height="45 ...

The text exceeds the maximum width of the table column

Currently, I am working with a table and utilizing the <col> tag to define column widths. However, I have encountered an issue where one of the columns, set at 5% width, contains a title that is 16 characters long, wider than the allocated 5%. As a ...

Altering the placement of a single element from floating to fixed positioning in CSS

Currently in the process of designing a basic website, I am looking to modify the behavior of the navigation bar on the left-hand side. I want it to remain fixed in its position so that users can scroll through the page without losing sight of it. My main ...

increasing the size of a particular text box above the rest

Just starting out with bootstrap and trying to figure out how to make one text box larger than the others. See my code below: <div class="row"> <div class="col-md-2"> <mat-form-field > <input matInput pla ...

Difficulty Clicking Links with CSS 3D Transformation

I'm currently working on implementing a CSS 3D transform effect on my website. However, I am encountering some issues with clicking the links once the card has been flipped over. Question Why is this happening? How can I resolve this so that I can ...

Unable to Submit Form in JSP Page

I have encountered an issue with a JSP page that contains a form which I am submitting using JavaScript. When the page has a smaller number of items, between 10-50, the submission works perfectly fine. However, when there are around 500 items or more on t ...

The autocomplete feature in Google Maps is not functioning properly when used within a modal

I've integrated the Google Maps API to enable autocomplete address functionality for an input box on my page. However, I'm encountering an issue where everything works fine on the page itself, but it doesn't work when the input box is placed ...

Awesome method of redirecting outdated URLs to the most recent established URL

My website heavily relies on JavaScript and communicates with a .NET C# RPC service. We encountered an issue where clients' browsers cached the JavaScript, so we decided to add a version number to the URL in order to force them to use the latest JavaS ...

Using mix-blend-mode with an SVG image within a colored <div>: tips for applying it to the background color of your HTML

I am facing an issue with a SVG file that has mix-blend-mode styles defined on certain elements. The blending is working properly for the elements inside the SVG, but not for the background color of the HTML <div>. For instance: <!doctype html> ...

"Is there a virtual keyboard available that supports multiple inputs and automatically switches to the next input when the maximum length

Looking to build a virtual keyboard with multiple inputs that automatically switch to the next input field after reaching the maximum length. Currently having an issue where I can only fill the first input and not the second one. Any assistance in resolvin ...

Javascript does not execute properly in Google Apps Script

Encountering issues while attempting to execute the code provided in Google app script. // 1.foldername = Folder name | 3.templateId = ID of the template to use // 2.SheetId = ID of spreadsheet to use. | 4.rootFolder = ID of the root fold ...

Utilize Flexbox to arrange elements in a column direction without relying on the position property in CSS

Flexbox - align element to the right using flex-direction: column; without relying on position in CSS Hello everyone, I am looking to move my row element to the right without using positioning. This code includes flex-direction: column; and I do not have ...

Filtering content with a sliding effect using CSS and JavaScript

I'm currently developing a jQuery mobile app that requires filtering posts on a specific page. I have already added the posts and designed the filter. Take a look at how it appears below: https://i.sstatic.net/mVh9X.png I am working on animating th ...

AD filter: eliminate empty spaces from attributes

Recently, I have encountered a VBS ASP script that utilizes the following filter: strFilter = "(&(objectCategory=person)(objectClass=user)(givenName=" & sFirstName & "*)(sn=" & sLastName & "*)(telephonenumber=*)" One issue I’ve run ...