Adjust the positioning of several divs using CSS floats

Can the pink div (link3/link4) start at the same top position as the div (link1/link2)?

Or do I still need a wrapper div for the left button bar, TreeDiv, and another one for the right button bar + DataGridDiv?

CSS

html 
{
    background-color:Yellow;   
    margin: 0;
    padding: 0;
    height:100%; 
}

body {
    background-color:Green;    
    color: #333;
    font-size: .85em;
    font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
    margin: 10;
    padding: 0;
    height:100%;
}

a:link, a:visited, 
a:active, a:hover {
    color: #333;
    outline: none;
    padding-left: 3px;
    padding-right: 3px;
    text-decoration: underline;
}

a:hover {
    background-color: #c7d1d6;
}

#TreeWrapper{
   background-color:Aqua; 
   float:left;
    width:200px; 
    height:100%; 
    overflow:auto;     
}

#DataGridWrapper{
     background-color:Silver;
     height:100%;    
     overflow:auto; 
}

.clear
{
    clear:left;    
}

#DataGridButtonBar
{
    background-color:Fuchsia;   


}

#TreeButtonBar
{  
    width:200px;
    background-color:Maroon;    
}

HTML:

 <div id="TreeButtonBar">
        @Html.ActionLink("link1", "AddNode")
        @Html.ActionLink("link2", "DeleteNode")
    </div>    

    <div id="TreeWrapper">
     Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor 
    </div>

    <div id="DataGridButtonBar">
        @Html.ActionLink("link3", "AddTeststep")
        @Html.ActionLink("link4", "DeleteTeststep")
    </div>

    <div id="DataGridWrapper">
     Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor 
    </div>


<div class="clear"></div>

Answer №1

Have you considered wrapping #TreeButtonBar and #TreeWrapper in a DIV and floating it to the left?

Alternatively, rearranging your DIVs slightly and using rows could be another solution.

<div>
<div id="TreeButtonBar"></div>
<div id="DataGridButtonBar"></div>
</div>

<div>
<div id="TreeWrapper"></div>
<div id="DataGridWrapper"></div>
</div>

I have come up with these ideas as potential solutions for achieving what you want. Have you already tried any of these methods or something similar?

Answer №2

Take a look at this demo. http://jsfiddle.net/P19Jm/

Be sure to maximize the output area in the demo.

Note: You won't need to utilize any containers in that example.

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

Mozilla displays the background color even when the visibility is set to hidden

When working with CSS, I've noticed that when I use visibility: hidden on a <td> tag in Mozilla, the background color still shows. To see an example, visit this jsfiddle. It displays fine in Chrome but not in Mozilla. ...

Is there a way to align both the horizontal and rotated lines to intersect at a common point in HTML and CSS?

As a beginner, I'm looking to create a structure resembling a thigh, leg, and ankle using thick lines. My aim is to rotate them with animation, ensuring that the joints between the lines mimic those of a knee joint and hip joint. Below is the code sn ...

Customizing Text Placement in HTML Lists with CSS List-Style-Image

Is there a way to adjust the vertical positioning of the "Blahs" in the list so that they appear closer to the center of each list bullet in the image displayed on my HTML code below? Here is the snippet of code: <html> <style> li { margin-to ...

Detecting a click on the background div in Angular without capturing clicks on child divs

Over at ollynural.github.io, I've been working on creating a pop-up div in the portfolio page that provides additional information about the project you select. To close the pop-up, I have implemented an ng-click feature so that clicking on the main p ...

Disabling the onClick event on HTML tags with personalized WooCommerce messages

I have customized the notices/success.php template file by modifying the content as shown below: <?php foreach ( $messages as $message ) : ?> <div class="woocommerce-message" role="alert"> <span> <?php ...

Embedding a picture within a uniquely shaped container

I have multiple sets of skewed divs and I would like to include a separate image in each of them. However, when I attempt to insert an image, it also becomes skewed and distorted. Is there a way to prevent this from happening? Ideally, I want the images to ...

What are the reasons for not utilizing JSS to load Roboto font in material-ui library?

Why does Material-UI rely on the "typeface-roboto" CSS module to load the Roboto font, even though they typically use JSS for styling components? Does this mix of JSS and CSS contradict their usual approach? ...

Is it possible to alter the input value dynamically before submitting the form or refreshing the

I am looking to automatically update a hidden input value to either "0" or "1" based on whether a user fills out the phone number field. My current code is below: <script> if(document.getElementById('user-tel').value!='') { docu ...

How can I align my dropdown menu to the right using jQuery Mobile?

I am trying to create a dropdown menu on the right side of my navbar, but I'm running into some issues. The element keeps floating left instead of right and the CSS for the li element is not being applied. I must be missing something. Can anyone offer ...

Minimum number of cards in each column

I'm currently utilizing media queries to make sure that my card-columns are shown in a responsive manner. However, I have noticed that there is a minimum requirement of 2 cards in each column before it moves on to the next one (from left to right). T ...

When the columns start stacking in Bootstrap, the padding is disabled

As I work on revamping my website, I have decided to incorporate the Bootstrap framework. While I can navigate through HTML coding, I still consider myself a novice when it comes to coding. The current issue I am facing involves the alignment of two colum ...

Retrieving Text from CSS Property with Selenium in Python

Having trouble identifying an input tag html element with Selenium Python? Not because of the wait. I need to extract text from a field on a web page with a form named Form1. Here is the html element when inspected in Chrome: Input Element: <input name ...

Ajax TabContainer mysteriously vanishes during Postback

I'm currently working on a GIS web application using C# ASP.net. Within my project, I have an Ajax TabContainer that houses multiple TabPanels containing various elements like a map window and scale bar from the ESRI WebAdf toolkit. Below is a simpl ...

Display a div element with sliding animation from the left side to the right

I am trying to create a slide-in effect on a div from left to right on my webpage, but it seems to be sliding in from right to left instead. I'm unsure of what the issue might be, can someone take a look and help me figure this out? $(document).rea ...

What is the best way to ensure a stable background image using CSS?

I have successfully created my navigation section and now I am working on the main body of the website. However, when I try to add a background image, it ends up appearing on the navbar as well. Can someone please assist me with this issue? Below is the HT ...

Implementing alternating row shades using Bootstrap

I am attempting to apply shading to every other row in a table. Here is the code snippet: dt:nth-child(4n+1) ,dt:nth-child(4n+1) +dd{ background-color:silver; } <div class="col-sm-2 tabularData"> <dl class="dl-horizontal"> <dt> ...

Transferring HTML table information to Django models for efficient data management

I am currently developing a student attendance management system using the Django framework. The objective is to fetch all the names of the students from the student database and display them in an HTML table. Additionally, I will be updating the informati ...

extracting data from a div while presenting a confirmation pop-up

I am attempting to extract information from a file on the following website. Specifically, I am trying to download an Excel sheet containing a complete directory of towns in TRIPURA, listed as the first item in grid format. Here is the code snippet I am ...

Experiencing an issue with the is_uploaded_file function for the temporary file when attempting to update information in case any of the three images have been modified

When attempting to modify one of three images in an information-editing form I created, I encountered errors: Error: Undefined index: file in /opt/lampp/htdocs/m-dev-store/admin_area/edit_product.php on line 345 Error: Trying to access array offset on va ...

Activate animation while scrolling the page

I am using a progress bar with Bootstrap and HTML. Below is the code snippet: $(".progress-bar").each(function () { var progressBar = $(this); progressBar.animate({ width: progressBar.data('width') + '%' }, 1500); }); <body> & ...