Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6104073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:48:02+00:00 2026-05-23T13:48:02+00:00

In a set of HTML pages that have some important text that requires a

  • 0

In a set of HTML pages that have some important text that requires a background-color. This can occur anywhere on the page.

I also have an image that must float right on every page. The text must wrap around this image.

Sometimes the text requiring a background-color needs to wrap around the floated image.

The problem is the background color of the text extends under the image. Like this:

background/float problem

Here is the html and CSS:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Float Problem</title>
    <style type="text/css">
        .main{ width:500px; }
        .floater { height:200px; width:200px; background-color:#C00; float:right; clear:left; margin:10px; padding:10px; overflow:hidden; }
        .importantText { background-color:#333; color:#FFF; padding:5px; font-weight:bold; }
    </style>
</head>
<body>
    <div class="main">
        <div class="floater">
        [An image here]
        </div>
        <p class="plainText">Integer luctus, nunc vel condimentum ornare, mi eros vehicula nisl, non adipiscing enim risus sit amet urna. </p>
        <p class="importantText">In hac habitasse platea dictumst. Fusce nec felis lorem. Fusce mollis ante elit, at tempor ipsum. Ut imperdiet libero sed sem rutrum rhoncus mattis erat aliquam. Aenean bibendum tincidunt erat sit amet varius. Vivamus sed arcu vitae magna aliquet porttitor quis sed augue. </p>
        <p class="plainText">Fusce molestie dignissim libero vehicula egestas. Suspendisse porta, felis et auctor suscipit, quam mi facilisis odio, id tempus lorem leo ac quam. Proin rhoncus dignissim eros, et commodo ante rhoncus sit amet.</p>
    </div>
</body>
</html>

I have tried many different proposed solutions, but none I have found work for this particular problem. Is there a way to get the background-color to fit to the text (and not go under the image)? Can this be solved with CSS or JavaScript (with access to jQuery)? The solution needs to work in IE7+, FF4+, Safari3+, and latest Chrome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:48:02+00:00Added an answer on May 23, 2026 at 1:48 pm

    Just add overflow: hidden; to the importantText class.

    See this demo fiddle.

    Tested on Win7 in IE7, IE8, IE9, Opera 11.50, Safari 5.0.5, FF 5.0, Chrome 12.0, but since this is basic overflow functionality, I know for sure it works in all the other required browser versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say I have this set of HTML-markup and CSS #CSS .inputhelp_text { background:
I have some pages designed by someone else as simple HTML that I need
I have web pages that contain text areas with HTML inside of them. For
We have some HTML pages (local, not on a web server) that use the
I have a PHP page that returns a piece of HTML to set the
I have a page with some HTML in it. and I need to set
I have a set of html files that I want to modify by replacing
I have some javascript code that is used in a few different pages in
I have a .NET 2.0 app (using C#) that shows some dynamically constructed HTML
I have an android app that has has this css for the body background:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.