List on the Left Side with Scroll Capability

In my ASP.NET web application that targets .NET 3.5 and utilizes an AJAX asp:UpdatePanel, I have structured the page layout using multiple div elements to divide the vertical space into sections - header, first content, second content, third content, and footer.

The first content section displays general information about the main item on the page such as title and properties. The third section contains additional tables of information related to the item. The headers and footers serve their standard roles.

The second content section is divided into two subsections - a list of images and the currently selected image. This functions like a thumbnail list where clicking on an item updates the displayed image. The selected image section within the AJAX asp.UpdatePanel includes a title, properties table, and the image itself that all update upon selection changes.

As the list of images can be substantial in length, causing whitespace between items, I aim to size the list to match the height of the selected image section with a scrollbar for overflow. Additionally, the selected image section must maintain a fixed height based on user-selected image size (small, medium, large).

I am seeking guidance on achieving this desired layout without specifying explicit widths or heights aside from the selected image's div. Various attempts with floating and other techniques have not yielded the intended results.

<html>
    <head>
        <style type="text/css">
html, body {
    margin: 0px;
    padding: 0px;
}
...
</style>
    </head>

    <body>
        <div id="page-header"><h2>My Page!<h2></div>

        <div id="first-section" class="section">
            ...
        </div>
        
        <div id="second-section" class="section">
            ...
        </div>

        <div id="third-section" class="section">
            ...
        </div>

        <div id="page-footer">End of My Page...</div>
    </body>

</html>

Answer №1

Check out this awesome link: !

CSS:

  body {
    margin: 0px;
    padding: 0px;
}

div {
    border-color: black;
    border-style: solid;
    border-width: 1px; 
    padding: 5px;
    margin: 5px;
}

div.image {
    background-color: red;
    color: white;
    text-align: center;
}

#page-header {
    padding: 10px;
    height: 60px;
    background-color: green;
    color: white;
}

#page-footer {
    padding: 10px;
    height: 20px;
    background-color: green;
    color: white;
}

.section {
}

#first-section {
}

#second-section {
    margin-left:auto; margin-right:auto; display:block;
}

#second-section-scroll-list {
    overflow-y: scroll;
    height:750px;
    float:left;
}

ul.scroll-list {
    list-style-type: none;
    margin: 0px;
    padding: 0px;
}

li.scroll-list-item {
    border-color: black;
    border-style: solid;
    border-width: 1px; 
    text-align: center;
}

#second-section-content {
margin-left:250px;
height:750px
    }

#third-section {
}

HTML:

  <div id="page-header"><h2>Welcome to My Page!</h2></div>

    <div id="first-section" class="section">
        <h1>Displaying the Item</h1>
        <table>
            <tr>
                <td>Property 1:</td>
                <td>Value</td>
            </tr>
            <tr>
                <td>Property 2:</td>
                <td>Value</td>
            </tr>
        </table>

    </div>

    <div id="second-section" class="section">
        <div id="second-section-scroll-list">
            <ul class="scroll-list">
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 1</div><br/>
                    Image 1 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 2</div><br/>
                    Image 2 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 3</div><br/>
                    Image 3 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 4</div><br/>
                    Image 4 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 5</div><br/>
                    Image 5 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 6</div><br/>
                    Image 6 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 7</div><br/>
                    Image 7 Description
                </li>
                <li class="scroll-list-item">
                    <div class="image" style="height: 120px; width: 160px;">Image 8</div><br/>
                    Image 8 Description
                </li>
            </ul>
        </div>

        <div id="second-section-content">
            <!-- This will be wrapped in an AJAX update panel -->
            <div style=" height: 725px; background-color: lightgray;">
                <h2>Selected List Item Details</h2>
                <table>
                    <tr>
                        <th>Property 1:</th>
                        <th>Value</th>
                    </tr>
                    <tr>
                        <td>Property 2:</td>
                        <td>Value</td>
                    </tr>
                </table>
                <div class="image" style="height:480;width:640;">Image of Selected Item</div>
            </div>
        </div>
    </div>
<br>

    <div id="third-section" class="section">
        <table>
            <tr>
                <th>First</th>
                <th>Second</th>
                <th>Third</th>
            </tr>
            <tr>
                <td>1</td>
                <td>A</td>
                <td>1A</td>
            </tr>
            <tr>
                <td>2</td>
                <td>B</td>
                <td>2B</td>
            </tr>
        </table>
    </div>

    <div id="page-footer">That's All for Now...</div>

I hope you find this information useful.

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

Chrome is having trouble displaying Roboto font correctly

I have been experiencing an issue with the rendering of the Roboto font on a client's website. When I view the site in Chrome (version 43.0.2357.65 m), all the different weights of Roboto appear to look the same. For example, here is a comparison: On ...

Issue with excessive content causing scrolling difficulty

I've created CSS for a modal dialog, but I'm facing an issue. When the content exceeds the vertical space of the wrapper, the scrolling functionality doesn't work correctly. Although I can scroll, it's limited and I can't reach th ...

The shadow is obscured by a block that has an 'overflow: scroll' property

One block on the left displays the list, while another shows detailed information with a shadow effect. The issue arises when the left block has 'overflow: scroll', causing elements' backgrounds to spill over the shadow. .div-left { flo ...

Issues with Bootstrap Contact Form submission

I found a helpful tutorial for creating a form at the following link: After following the tutorial, I added these scripts to the bottom of my contact form HTML: <script src='https://code.jquery.com/jquery-1.12.0.min.js'></script> ...

What is the best way to create two fields side by side within a single row?

I'm struggling to merge the data array of two different identity types into one row as a field. Here's the code I've written: import React from 'react' import {Form,Field,ErrorMessage,Formik} from 'formik' import * as yup ...

Implementing a consistent CSS structure for various media sizes

Utilizing CSS grid and Sass, I implement varying grid layouts for different screen sizes (phone, tablet, desktop). However, on certain pages, I desire the same layouts at slightly larger or smaller screens than others. Is there a way to achieve this witho ...

Leveraging the Scroll feature in Bootstrap for smooth scrolling

Seeking assistance with implementing scroll in Bootstrap 5 on my child component (ProductList.vue). Can anyone guide me on how to integrate the code? I have been searching for a solution without success. Below is the Bootstrap 5 code on the child component ...

What is the best way to align elements in relation to a central div container?

Is there a way to align two buttons in the center on the same line, and then position a selector to the right of those centered buttons? How can I achieve this arrangement? Essentially, how do you position an element in relation to a centered div? UPDATE: ...

Creating responsive images in Bootstrap columns

I've found a solution to my issue with large images, but I am still struggling with smaller images not fitting well into larger spaces. Essentially, I created a CMS for a user who required templates with various bootstrap columns as content areas. Cu ...

Troubleshooting jQuery click event listeners and AJAX requests: Issue with second listener not functioning properly

There are two click listeners implemented on a page, one for a sub-navigation menu (which dynamically changes the list items in the menu) and another for a main menu (which dynamically changes the content in another section). <nav class="sub-nav"> ...

What are some effective methods for maintaining the integrity of HTML content?

Attempting to safeguard HTML content generated in a specific location by powerMTA. Here is the code snippet of the HTML content. Content-1. <html>=0A<body>=0A<table style=3D"max-width:576px;font-family:Arial, Helvet= ica, sans-serif;&q ...

Deliver JavaScript and HTML through an HTTP response using Node.js

My attempts to send both a JavaScript file and an HTML file as responses seem to be failing, as the client is not receiving either. What could be causing the client to not receive the HTML and JavaScript files? I am using Nodejs along with JavaScript and H ...

Link insertion column

How can I insert a hyperlink into this particular column? <div class="col-md-6" style="height: 125px;"> <div style="background: #ffffff;"></div> <div class="borde ...

Utilize MaterialUI Grid to define custom styles for the ::after pseudo-element

I came across a helpful article on Stack Overflow about Flex-box and how to align the last row to the grid. I'm interested in implementing it in my project: .grid::after { content: ""; flex: auto; } However, I'm not sure how to inc ...

Replicating a tag and inputting the field content

Scenario: An issue arises with copying a label text and input field as one unit, instead of just the text. Solution Needed: Develop a method to copy both the text and the input field simultaneously by selecting the entire line. Challenge Encountered: Pre ...

What is the best way to implement backup style attributes for a React JS component?

Is there a method to implement fallback style properties for a component? For example: var inlineStyle = { display: '-webkit-box', display: '-webkit-flex', display: '-moz-box', display: '-moz-flex', ...

There seems to be an issue with the functionality of the JavaScript Quiz as it is

While working on my JS quiz, I encountered an issue where some answers were not displaying due to quotes and the need to escape HTML characters. Additionally, I am facing difficulty in accurately awarding points or deductions based on user responses. Curre ...

Position a div in the center both horizontally and vertically within a section, ensuring that each section expands to fill the entire page when scrolling

I'm currently working on coding a page layout where each section takes up the entire screen. My goal is to have the content within each section centered both vertically and horizontally. I'm unsure if this is achievable, so any guidance or advice ...

The HTML form is not displaying any content and instead is returning "Not a Number

I've been struggling to create a form that can generate a numerical value based on the input from two fields. Specifically, I need to calculate the output by subtracting the product of two values - one entered in an input field and another selected vi ...

Issue with deactivating attribute through class name element retrieval

There are multiple input tags in this scenario: <input type="checkbox" class="check" disabled id="identifier"> as well as: <input type="checkbox" class="check" disabled> The goal is to remov ...