In certain instances, content spills beyond the boundaries of a div element in Chrome 43

In my design, I have a purple block that contains text of varying lengths. The block is responsive and its width is set in percentage.

Some users using Chrome (v43.0.2357.65) on Windows XP are experiencing issues where the text overflows beyond the edge of the purple box unexpectedly. It's difficult to replicate this consistently. I'm attempting to resolve the overflow issue by adding max-width and word-wrap properties to the text container div.

The website is in Dutch.

<div class="mt-landing__section-notification">
<div class="mt-landing__section-notification__info-icon icon-info"></div>
                <div class="mt-landing__section-notification__close-icon"></div>
                <div class="mt-landing__section-notification__content">
                    <div class="mt-landing__section-notification__message">
                        This is where the text is. 
                    </div>
                </div>
            </div>

Here is the CSS code for the outermost div and the text-containing div:

.mt-landing__section-notification {
    z-index: 1;
    width: 64.5%;
    background-color: #411E4E;
    padding: 20px;
    color: #fff;
    box-sizing: border-box;
    position: relative;
    float: left;
    margin-top: 0px;
    display: block;
}
 .mt-landing__section-notification__message {
     line-height: 24px;
     margin-top: -3px;
     word-wrap: break-word;
     max-width: 100%;
}
 .mt-landing__section-notification__content {
     margin: 0px 50px; 
  }
  .mt-landing__section-notification__info-icon {
       width: 50px;
       float: left;
       font-size: 24px;
  }
  .info-icon {
      font-family: mt-icons;
      font-style: normal;
      font-weight: 400;
      font-variant: normal;
      text-transform: none;
      line-height: 1;
   }
   .info-icon::before {
        content: '\e617';
    }

Does anyone have insights into why the text is overflowing?

Answer №1

It appears that the issue may be with your info icon.

To resolve this, you can either: a) Set the icon to position:absolute and the container to position:relative. This will remove the icon from the flow, preventing it from pushing the text to the right.

Or b) Consider using the icon as a background-image. Increase the padding-left of the container and set the icon as a background-image. This method is simple and helps maintain order while remaining flexible and responsive:

https://jsfiddle.net/svArtist/s3xc3nro/

.custom-notification-section {
    z-index: 1;
    width: 64.5%;
    padding: 20px;
    color: #fff;
    box-sizing: border-box;
    position: relative;
    float: left;
    margin-top: 0px;
    display: block;
}
.custom-notification-content {
    line-height: 24px;
    margin-top: -3px;
    word-wrap: break-word;
    max-width: 100%;
}

.icon-info{
background: url(http://www.example.com/images/info.png)  #411E4E no-repeat 10px center;
    padding-left: 50px;
    min-height: 50px;
    box-sizing:border-box;
}
<div class="custom-notification-section icon-info">
    <div class="custom-notification-close-icon"></div>
    <div class="custom-notification-content">
        <div class="custom-notification-message">This is where the text goes.</div>
    </div>
</div>

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

Lost in a sea of confusion with ember-cli-postcss and autoprefixer

I'm currently working on an ember build that incorporates autoprefixer. My issue arises from the fact that the output location for 'assets/application-name.css' has shifted from its normal path to 'app/styles/app.css', and I would ...

Caution: It is important for each child within a list to have a distinct "key" prop when using react-input

I'm currently facing an issue with the following code snippet: {array.map((item) => ( <> <input key={item.id} type="checkbox" /> ...

What is the method to display my input value within my application interface rather than triggering an alert popup?

Hi there, I am seeking assistance with my GUI code. I want the input value to be displayed as text on the screen, or even better, to look like a chatroom so that I can integrate a simple chatbot later on. My main goal is to have the texts show up in the bl ...

Having issues with image hover and click functionality

My website has an image with the cursor set to pointer and a function that should show a hidden element when clicked. However, it's not working at all. When I hover over it or click on it, nothing happens. Here is a screenshot of the issue along with ...

What is the proper way to safely escape a JSON string for an object that contains user-generated content?

How can I correctly use the variable s for the value-field of an option-element while escaping user input used for key and value? var key='highway'; var value='track'; var s = JSON.stringfy({ [key]:value }, undefined,''); s ...

Guide to Making Colorful Text Inside Bootstrap 5 Tooltip

When trying to include the double quote character " in a custom HTML tooltip, it appears to cause the tooltip to malfunction. This results in the browser mistakenly treating the tooltip title as completed and interpreting a portion of the title as ext ...

Creating an invoice or money receipt using HTML is a straightforward process that involves using specific code and

Currently, I'm in the process of developing an application for a land developer company. The administrator of this application will be responsible for creating invoices, money receipts, and bills. I am looking to design these documents to resemble th ...

Ways to Resolve Issues with WordPress Update and Publish Failures

It has been quite some time since Gutenberg was introduced to us, and it seems like we all have a complicated relationship with it. Navigating the Block editor to create a post or page can be challenging, especially when it used to be so simple. But what& ...

Maximizing the use of default top positioning for absolutely positioned elements

After observing that an element with position:absolute can have its default top value determined based on its immediate parent's position, regardless of whether it is set to relative or not, BoltClock explained that in such cases, it remains in a stat ...

Make the active navigation bar item bold and change its font color when clicked

I'm currently working on creating a navigation bar that changes font weight to bold and color to teal when a link is clicked. The issue I'm facing is that when the links are clicked, they turn blue instead of teal and lose their bold formatting, ...

Is there a way to clear out all items from the cart using PHP?

I have a shopping cart with items that I want to remove all at once. I tried creating a submit button with the post method called 'remove_all', but it's not working and showing an error message saying "The requested URL was not found on this ...

I am experiencing an issue with the display inline feature not functioning properly in Firefox

I am working with Html code: <div class="login"> <form class="form-horizontal signin"> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label">Ema ...

Can you explain the significance of using `!important` in CSS without specifying a value?

Scenario: Currently, I am facing an issue with using the bootstrap 4 stylesheet in conjunction with NextJS. The bootstrap 4 stylesheet, compiled from SASS, contains code like: .checkbox.checkbox-accent > span { border-width: !important; } This speci ...

Conceal an entire div using CSS, especially if a portion of it remains unoccupied

Is there a way to conceal an entire division if a part of it is void? For instance, if "dd" is empty as indicated below, can I hide the entire class "test" so that the keyword Restrictions does not display either? I attempted .test dd:empty { display: none ...

Is Jsoup receiving the HTML incorrectly?

Currently, I am utilizing Jsoup to fetch HTML data from a website and attempting to display it in a ListView within my app. Although the application compiles without any errors, clicking the button results in an empty ListView. In my opinion, this issue ...

Price Table with Unique CSS3 Design Shapes

I'm currently working on designing a price table that resembles a bone shape. I stumbled upon some code on CodePen that could help me achieve this look, but I'm unsure of how to tweak and merge it. I'm facing difficulties when it comes to s ...

What purpose does '& .MuiTextField-root' serve within the { makeStyles } function of Material UI?

I've been working on a React JS project using Material-UI and came across some interesting styling in my Form.js file. Here's a snippet of the code: import useStyles from './styles'; const classes = useStyles(); <form autoCapitali ...

Issue with displaying Git remote repository on list item element (ul) not appearing

My attempt to showcase my GitHub repositories via their API is not displaying on my webpage, even though the exact same code works perfectly fine here on JSFiddle Upon debugging, it seems that the script is being invoked but the content is not loading wit ...

Modify the hover color of heading 1 only for hyperlink texts

I am attempting to adjust the hover color specifically for text that contains a link. Below is the CSS code I have tried, but it changes the color regardless of whether there are links present or not. h1, h2, h3, h4 { color:#3F3F3F; } h1:hover, h2:hove ...

Rows with an ambiguous number of horizontal lines

I am looking to create multiple rows that are horizontally floated, as shown in the image. However, I am facing an issue with setting the width of the container because I do not know the exact number of rows that will be added. Currently, my code looks li ...