I am unable to contain my span within a div container

While Firefox, Safari, and Chrome seem to work fine with my code, I am encountering issues with Internet Explorer... Here is the snippet of my HTML:

<div id="sc-footer">Total<span id="sc-total">$0</span></div>

And here is the corresponding CSS:

#sc-footer{
 font-size: 1.6em;
 line-height:1.5em;   
 position:absolute;
 bottom: 20px;
 padding:9px 5px;
 height:20px;
 background: #dadada;
 color: #545454;
}
#sc-total{
 display:inline;
 float:right;
}

Answer №1

An alternative option would be to apply overflow:auto to the #sc-footer element.

Answer №2

To position your span in front of the term Grand Total :)

Answer №3

To align the Total text to the right of the <div>, simply add text-align:right; in your CSS.

It is not recommended to float a <span>. If floating is necessary, consider using a <div> instead, as floats are generally intended for block elements like divs, while spans are inline elements. Additionally, it is advisable to specify a fixed width for floated elements when targeting Internet Explorer to ensure more explicit rendering, especially with older versions of the browser where specificity is key.

Answer №4

@realtalk: Remember to utilize the "div" tag for block elements and the "span" tag for inline elements. Your current markup and styles demonstrate a lack of knowledge in markup semantics, so it would be wise to educate yourself before diving into markup or CSS. Neglecting this could result in having to backtrack later on to improve SEO, which could have been avoided with proper initial execution. Additionally, failing to pose a question and instead immediately criticizing IE is unproductive.

@codeguru24: Using unnecessary span tags serves no purpose.

@webdevpro: Avoid resorting to hacks!

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

Stylish Dropdown Menu with Regular Buttons

Currently, all buttons have a hovering effect, but I only want one button to behave this way. I need two buttons to immediately redirect to another page upon clicking, without any hover effect. The CSS styling code has been provided below: #wrapper { ...

What is the process by which the browser displays pseudo-element selectors?

One thing that's been on my mind is the potential resource cost of using *:after. Would the pseudo element be the primary selector, or would all elements still be processed by the client? In simpler terms, what impact does *:after have compared to ju ...

Text appears unclear and fuzzy when using Firefox browser

While my website looks fine on Chrome and Opera, it appears blurry on Internet Explorer and Firefox. I've tried researching and applying different CSS styles, but nothing seems to work. Both my Firefox and Internet Explorer versions are up to date, an ...

Trigger the fadeIn effect on multiple divs consecutively as they are scrolled to the bottom each time using Jquery

On my website, I want to implement a feature where more divs load using a smooth fadeIn() animation when the user reaches the bottom of the page. Initially, I had this code in mind: $(document).ready(function() { $(window).on('scroll resize' ...

What is the best way to display just four boxes on a screen that has a scrolling element?

I have a container element with a specific width (while the height can vary) and a scrollbar. Inside this container, there are boxes. Each box has dimensions equal to half of the width/height of the container with the scrollbar. My goal is to display only ...

Adjusting the page view when a collapse is opened

I am working on a website that features 3 images, each of which opens a collapse below with an embedded iframe website inside when clicked. I am trying to implement a function where the site automatically scrolls down to the opened iframe when an image is ...

Two rectangular divisions placed next to each other, with one perfectly centered and the height of the second division adjusting to match the height of the

I attempted to implement the Matthew James Taylor method, utilizing three columns. However, my main issue arises when I desire the middle column to dictate the height. In other words, if the center div is 500px in height, I want the right div's height ...

Positioning a video element in the center using the margin property with a value of 0 and

I'm having trouble getting this video element centered on my webpage. Here's the code snippet I've been working with: HTML <div id="container">     <video id="vid" x-webkit-airplay="allow" controls width="640" height="360" src ...

Incorporating External Content into Your HTML Website

Looking to incorporate third-party content in the form of an HTML page within my own website, I considered utilizing iframes. This would allow me to embed the external HTML page within my site while keeping their libraries and CSS separate from mine. Howe ...

What methods can be used by CSS or JavaScript to respond to the various stages of the Azure B2C Email Verification process?

Our Azure B2C custom policy includes email verification during sign-up to combat spam accounts. The default email verification process in B2C can be cumbersome as it requires users to complete multiple steps on the same form: Enter email. Send verificati ...

Responsive HTML table with full width of 100%

I am attempting to make an HTML table responsive by setting the two td elements to occupy 100% width on smaller screens. This is what I have so far... .test1{ background:teal; text-align:center; padding:20px; } .test2 { background:tan; paddin ...

How can I create a box-shaped outline using Three.js?

As someone new to threejs, I have been trying to figure out how to render a transparent box around a symbol in my canvas. The box should only display a border and the width of this border should be customizable. Currently, I am using wireframe to create a ...

Adjusting form field sizes using Bootstrap - a step-by-step guide

Bootstrap form creation help needed! Check out my code snippet below: <div class="container"> <form action="" method="post" id="payment-form" novalidate autocomplete="on"> <span class="payment-errors"></span> <div class="for ...

Use Bootstrap 4 to create a scrollable list-group that can be displayed in a row using flexbox, all while allowing the list to scroll independently

Currently, I am utilizing Bootstrap 4, specifically alpha-6 version. Here's the scenario I'm dealing with: <body> <!-- A div is automatically generated within a randomly assigned ID and class --> <div class="bigone"> ...

Troubleshooting Problems with CSS in Safari (Could Negative Margins be the

My problem lies specifically in Safari. Here is a screenshot of the issue: https://i.sstatic.net/amPeA.png To further investigate and experiment, I have created a fiddle at https://jsfiddle.net/hbadvb02/6/. Interestingly, the code works perfectly in Ed ...

Unlocking the Potential of Larger jQuery Icons

In a recent announcement, the jQuery team unveiled new icons for their UI components. However, I have been unable to locate any examples of how to use them or where they can be downloaded from. Also, it appears that the themes in the ThemeRoller only provi ...

Adjust size of logo in navigation bar header

Having trouble resizing a logo within a navbar-header? Check out the code below: <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <spa ...

Trigger and maintain click action in Javascript

I am currently in the planning stages of a project, and I'm facing an issue with a click and hold event. My goal is to have a div that allows me to click through it (meaning I can still interact with elements underneath), while having an opacity of ar ...

Hide/Trim the upper right corner of the button

I am looking to customize the top right corner of a button in order to add a badge in that area. Here is an example of what I have in mind: https://i.sstatic.net/j0xdz.png https://i.sstatic.net/uFzDw.png The image on the right showcases my current setup ...

Adjust the image size in the jumbotron to fit perfectly without the need for scrolling

I'm in the process of creating a website with a prominent jumbotron section on the landing page. I am looking to adjust the height of the image within the jumbotron without cutting off any parts of the picture, and I do not want it to scroll to displa ...