Overlapping spans

I am trying to stack these spans on top of each other without much success,

http://jsfiddle.net/76NNp/79/

<td class="rtf hov">
    <div>Investment</div>
    <div class="mub eub">
        <span style="float:left">Test</span>
        <span style="float:right;">I want to be at the top</span>
        <span style="float:right; color:green">I want to be at the bottom</span>
    </div>
</td>

My goal is to achieve the following layout:

Answer №1

Here is a different approach

CSS

.left{
    float:left;
}
.right{
    float:right;
}
.clr{
    clear:both;
}

HTML

<div class="msub estextsub">
    <span class="left">Top Priority</span>

    <span  class="right">I want to be First</span>
    <div class="clr"></div>
     <span  class="left">Importance Test</span>
    <span  class="right">I need to be at the bottom</span>
</div>

Check out the Demo here

Answer №2

Have you considered using position for optimal layout placement? Check out this example: http://jsfiddle.net/76NNp/87/

<span style="position:absolute;top:0; right:0">I want to be on Top</span>
<span style="position:absolute;bottom:0; right:0">I want to be on bottom</span>

Answer №3

To ensure proper alignment, add clear: both to both spans. See the updated code below:

.rtddef {
    padding: 10px 0 10px 10px;
    vertical-align: top;
}
<td class="rtddef es1hov">
    <div>Investment</div>
    <div class="msub estextsub">
        <span style="float:left;clear:both;">Test</span>
        <span style="float:right;clear:both;">I want to be on Top</span>
        <span style="float:right; color:green;clear:both;">I want to be on bottom</span>
    </div>
</td>

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 best way to make a linear gradient that spans the entire vertical space that is visible (or shifts to a solid color)?

I'm trying to figure out how to apply a linear gradient to the body element of my webpage. Here's the CSS code I've been using: body { background: linear-gradient(0deg, white, lightgray); } The issue I'm facing is that the gradien ...

Typescript input event

I need help implementing an on change event when a file is selected from an input(file) element. What I want is for the event to set a textbox to display the name of the selected file. Unfortunately, I haven't been able to find a clear example or figu ...

Guide to modifying the text color of a Primefaces/jqPlot line chart:

I've implemented a basic JSF line chart with PrimeFaces (using jqPlot library) in my project: <p:lineChart id="linear" value="#{team.chart}" title="Lap Times" xaxisLabel="Lap" yaxisLabel="Time ...

Unexpected token . encountered in Javascript: Uncaught Syntax Error. This error message is triggered when

As someone who is completely new to programming, I was given the task of creating a voting website for a class assignment. In order to store data locally, I managed to create variables and implement them using local storage: var eventName = document.getEl ...

Resize the main container to fit the floated elements

I've been working on constructing a family tree, and the last part of the functionality is proving to be quite challenging for me. My family tree consists of list elements that are all floated to the left. Currently, when the tree expands beyond the ...

Show the particular entry to be viewed upon clicking the link provided in the email

How can I create a link in an email that, when clicked, displays data for a single record? Currently, I have a datatable on the index page that shows all records when the app is opened. When a change is made to a record, an email is sent out with the ID o ...

The Ajax request is not being triggered when using a different form submit method

Being a tech enthusiast, I have developed a handy function: function blur_slide_visit_count(){ $.ajax({ type: 'POST', url: 'add_save_slide_visitor_count.php', async: false, data: { fillvalue: fieldAr ...

The positioning and floating of two divs are set to fixed without using percentage width, however, the functionality is not

Apologies for my poor English writing :) I am attempting to float two divs side by side in a fixed position, without using percentages. This code works well on most browsers but is not compatible with IE 6. HTML <div class="right"></div> < ...

Error in Cordova Android Compilation ("unable to locate Build Tools version 24.0.1")

I'm currently experiencing some difficulties while trying to compile my Cordova project on Android. Upon entering the command "cordova build Android", I encountered the following error message: FAILURE: Build failed with an exception. * What caused ...

Interactive Content Swapping: How to Use Javascript for Dynamic Link Updates

http://jsfiddle.net/bUjx7/42/ <script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'> </script> <script type='text/javascript'> $(document).ready(function () { $('.fieldreplace ...

Can you explain the meaning of the code provided below?

I'm having trouble understanding the functionality of this code snippet: .bind(this); (I copied it from the Zurb Foundation dropdown plugin) .on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function ( ...

display directories and subdirectories within a side panel

I have a main folder named 'server'. Inside this folder, there are two subfolders called 'computer1' and 'computer2'. Further inside 'computer1' and 'computer2', there are more folders. Currently, I have a ...

What is the process for retrieving data submitted in JSON format?

Hello there! Programming Query: $("#user-search_input").autocomplete({ source: function( request, response ) { var form_data=$("#user-search_input").val(); $.ajax({ url: "./AutoCompliteFind/", dataType: "json", typ ...

What are the capabilities of Ajax when it comes to utilizing select controls in J

Is there a way to trigger an ajax call when a select control value is clicked? The onChange event doesn't seem to work for me in this case :( This is what I have tried so far: JAVASCRIPT: <script> function swapContent(cv) { $("#myDiv"). ...

Is there a way to automatically fill a form from a database using the HTML column of a gridview?

I have developed an asp.net webform that contains checkboxes and textboxes. Upon submission, the data is stored in a SQL Server database. In addition to this form, I have created another webform with a gridview displaying the submitted data. My goal is t ...

Selenium for handling multiple input fields

Having some trouble figuring out how to input values for selecting a building. Initially, there are two empty input fields for selecting a building. As you enter one, it should add an additional empty input field. I'm struggling with the indexing and ...

The table is hidden and the buttons are unresponsive when inserted using jQuery

Exploring blueimp's jQuery-File-Upload Demo has been occupying my time recently. After studying it for several days, I feel like I've gained a solid grasp of how it functions. However, as someone with limited experience in web development, there ...

Trying to organize JSON data by multiple parameters using jQuery

Regarding the topic discussed in this thread; I have successfully managed to sort an Array of JSON Objects by two fields. Additionally, the discussion mentions: "To include additional columns for sorting, simply add them to the array comparison." // ...

Tap on the div nested within another div

Here is the scenario I am dealing with: <div id="main"> <div id="a"></div> <div id="b"></div> </div> On my website, element B is positioned below element A. How can I attach a click event only to those A elements t ...

The resource could not be loaded: net::ERR_FILE_NOT_FOUND error encountered when trying to load <img> tag

I attempted to insert an image using the 'img html tag' on my page (index.html). The image is located in the folder (imgs) within my project directory (Book_Store). Despite my efforts, I encountered this error message: Failed to load resource: ...