Content overflowing the container - Designed to adapt to different screen sizes

I'm currently working on a project within the Bootstrap 3 framework and struggling with an issue regarding text overflow in extra small view. The text is not behaving as expected, as it should stick to its container and break accordingly. I've experimented with various CSS properties like word-wrap, word-break, and text-wrap, but none seem to resolve the problem.

This is how the current layout appears:

This is the snippet of code causing the issue:

<div class="comments-area row">
    <div class="user-info col-lg-2 col-md-2 col-sm-2 right">
        <img src="{{ S_AVATAR_PATH }}" height="75px" alt="Avatar" class="comment-avatar valign-top img-circle cream-thick-border" />
    </div>
    <div class="col-lg-1 col-md-1 col-sm-1" style="width: 2%;"></div>
    <div class="comment-rag col-lg-9 col-md-9 col-sm-9 left" style="padding: 0;">
        <div class="comment-content">
            <span class="small">
                Posted by <strong>Username</strong>
                <span class="grey">
                    &nbsp;/&nbsp;30 likes
                    &nbsp;&bull;&nbsp;30 dislikes
                    &nbsp;/&nbsp;30 days ago
                </span>
            </span>
            <span class="pipe-hide">&nbsp;|&nbsp;</span>
            <span class="comment-options">
                <span class="comment-option glyphicon glyphicon-thumbs-up"></span>
                <span class="comment-option glyphicon glyphicon-thumbs-down"></span>
                <span class="comment-option glyphicon glyphicon-minus-sign"></span>
            </span>
            <br />

            <span class="break">Lorem ipsum dolor sit amet, fastidii dissentiunt et pro, pri eu rebum omnes nusquam, has et iudico facilis forensibus. In wisi facete deterruisset has. Eirmod option officiis vis ad, mea no dicta ornatus scriptorem, vim te primis option. Stet invenire vis te. Per at omnis commodo, quot debet recteque duo id. Ius aeterno ponderum platonem an. Reque deleniti ei cum. Ut probo liberavisse pri, graeci saperecommodo, quot debet recteque duo id. Ius aeterno ponderum platonem an. Reque deleniti ei cum.</span>
        </div>
    </div>
</div>

Additionally, here's the definition of the .break class being used:

.break {
    word-wrap: break-word !important;
    word-break: break-all !important;
    text-wrap: suppress !important;
}

Despite including these styles, my text is still not breaking correctly within Bootstrap. Does anyone know what might be causing this issue?

Answer №1

Can someone provide the CSS code for the comment-content element?

I found that setting a fixed width for the comment-content class improves the display of the content.

Take a look at this 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

Is it possible to modify an HTML element when hovering over it in an ASP.Net page?

Is there a way to use jQuery to show the child span text - SomeClassChild3 string when hovering over the parent div - SomeClassParent in an aspx page? Here is the JavaScript section of the code: function ShowDiv(Somedata){ for(var v in Somedata){ va ...

Transform the colors of rich text content to match dark mode, similar to the feature in MS

Seeking a solution to convert rich text content colors into dark mode without relying on the filter:invert(1) CSS option. Microsoft Outlook manages this conversion effectively, unlike the current method that turns magenta color into green in dark mode. Ou ...

Do you know where I can locate the HTML and CSS pertaining to the search results page

I'm looking for a way to present search results on my website that resembles the Google search results, creating a familiar interface for users. Is there anyone who knows where I can obtain the HTML and CSS code that produces the same style as Google& ...

Methods for altering the color of a div using addEventListener

Why doesn't the color change when I click on the div with the class "round"? Also, how can I implement a color change onclick? var round = document.querySelector(".round"); round.addEventListener("click", function() { round.style.backgroundCol ...

Position the title of the Bootstrap selectpicker field to the right

I utilized Creative Tim's Material Dashboard Pro to create a select field. My goal is to align both the select field and its options to the right. Currently, I have only been successful in aligning the options while the title and selected option rema ...

Is there a way to make smaller svg images align side by side instead of wrapping or being pushed to the next line?

I am trying to display 6 svg images side by side in a row, but I am encountering some layout issues. The images have varying widths, but the same height. I have used the height property to scale them proportionally. However, the image container is taking ...

SVG files do not fetch external CSS stylesheets when embedded in the DOM

Take a look at this example on jsFiddle. When using IE, the external CSS is loaded and the rectangle is red, but in Chrome and FF the rectangle stays black. What causes this difference? <!-- Used for referencing the external css --> <?xml-styl ...

JQuery's attempt to disable the 'hover' feature fails to function as intended

I have a styled table where rows change background colors based on odd and even indexes, with a hover effect included. However, I want to disable the hover effect when a row is selected. Here's the current code snippet: .odd{ background: #f7f7f7 ...

Distinguishing background colors depending on the browser's compatibility with CSS properties

I've successfully designed a polka dot background using pure CSS: .polka-gr{ background-image: radial-gradient(#FAFFB3 20%, transparent 0), radial-gradient(#F1C3CB 20%, transparent 0); background-size: 30px 30px; background-positio ...

Wait for the jQuery UI tabs to load until the entire HTML has been rendered

I have implemented jQuery UI tabs on my website. Occasionally, when the page first loads, all the HTML content for each tab is visible before the tabs themselves appear. This causes a slight delay in positioning the content within the tabs and creates an ...

The functionality of data attributes in jquery mobile is not functioning correctly

Within my header, I have included the following code: <link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.5.css"> <script type="text/javascript" src="js/jquery-1.11.2.js"></script> <script type="text/javascript" src="js ...

Is it possible to utilize a separate, standalone stylesheet for media queries?

My understanding of media queries evolved when I discovered them yesterday during my research on creating mobile-optimized pages. I learned that a media query refers to a stylesheet that complements and supersedes the current one, which differed from what ...

The total height of the document's body in jQuery is not equal to the sum of the viewport height and the window's scroll top position at the bottom of the document

Why does the document height appear smaller than the window scroll top value plus the viewport height when I reach the end of the document? Shouldn't they be equal? I've been struggling with this issue for hours and can't seem to figure it o ...

trigger jquery popup from server-side code (ASP.Net VB)

Within my code, I have created a div element which serves as a popup message: <div class="info message"> <h3>Informa&ccedil;&atilde;o</h3> <p>Mensagem informativa.</p> </div> In addition, ther ...

What is the method to create a resizable table column border rather than resizing the bottom corner border?

At the moment, we are able to resize the table border when we drag the corner. However, my goal is to enable resizing on the right side of the full border. https://i.sstatic.net/yFI24.png Below is the CSS code for resizing: th{ resize: horizontal; ove ...

What is the best way to update the content of a modal using jQuery and AJAX?

Despite previous inquiries on this matter, none of the answers provided have been helpful to me. Therefore, I am addressing the issue again... I am currently developing the frontend of a website that does not involve any backend functionality (no server c ...

Tailwind custom classes are not being rendered on mobile devices and Chrome DevTools, however, they are functioning properly on desktops and Safari DevTools

During the development of my project using Tailwind CSS, I focused on desktop compatibility and ensured responsiveness with Safari and Google Chrome. However, upon switching to DevTools, I encountered issues that persisted when testing on mobile devices. ...

I'm having trouble with the margin-right property in my HTML code. What's the best way to align my content

Currently, I have been delving into the world of Responsive Design. However, I am encountering some difficulties in positioning my content centrally when the screen size increases. The issue is as follows: @media screen and (min-width: 950px) { body ...

What is the most effective method for incorporating a floating section next to a Susy gallery?

Check out my latest progress on the codepen here The number of items displayed in the gallery is dynamic based on search results. However, I am looking to add a fixed area to the right side that remains visible as the user scrolls through the gallery. Ess ...

Tips for directing attention to a specific row with an input field in JavaScript

I duplicated a table and added an input field for users to search or focus on a specific row. However, there are two issues: When a user enters a row number, the table displays the wrong row - for example, if the user enters 15, the table shows row number ...