Words curl around the far-off entity

Challenge

I'm currently working on a project where I need to place an interactive info box next to other elements in the DOM. However, I've encountered an issue with text from one paragraph wrapping around the text in a separate div, even though they are not close together in the layout.

You can see the issue demonstrated in this Fiddle.

I have found a workaround by making the preceding paragraphs position absolute, but this solution comes with its own set of problems. If there is a better way to address this issue, I would greatly appreciate any suggestions or insights.

Here is the HTML and CSS code snippets:


<br>
<br>
<p id="problem">Text which will cause word wrap.</p>
<div id="container">
    <p>Text which is being wrapped around the text, despite the fact that the text is not nearby</p>
</div>

CSS


#problem {
    display: block;
    float: left;
    height: 16px;
    line-height: 16px;
    margin-bottom: 0px;
    margin-top: 2px;
    width: auto;
}
#container {
    background-color: rgb(255, 150, 150);
    display: block;
    font-size: 14px;
    height: 188px;
    left: 220px;
    margin-left: 15px;
    margin-top: -25px;
    padding: 4px;
    position: relative;
    top: -22px;
    width: 200px;
}
#container p {
    color: rgb(216, 0, 12);
    display: block;
    font-size: 14px;
    height: 96px;
    line-height: 16px;
    margin: 0;
    width: 200px;
}

Update: The updated fiddle now includes more context for clearer understanding.

Answer №1

wrapper {

margin-top: 60px;

}

content {

background-color: #A1A1A1;
width: 250px;

}

content input {

float: left;

}

issue {

display: block;
float: right;
height: 18px;
line-height: 18px;
margin-bottom: 5px;
margin-top: 2px;
width: auto;

} .control { height: 35px; width: auto; }

box {

background-color: rgb(255, 130, 130);
display: block;
font-size: 16px;
height: 190px;
left: 280px;
margin-left: 20px;
padding: 5px;
position: absolute;

width: 220px;

}

box p {

color: rgb(206, 10, 12);
display: block;
font-size: 16px;
height: 100px;
line-height: 18px;
margin: 5px;
width: 220px;

}

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

How can I create a floating thumbnail gallery that displays extra content when hovered over? Is there a way to make the hovered thumbnail overlap its neighboring

I am currently working on a gallery of thumbnail images. Each image is accompanied by a title below it: <div class='gallery'> <div class='thumb'> <div class='thumbimage'></div> <div class ...

Using AJAX to store the state of a Bootstrap accordion

Utilizing Ajax to fetch data from an API, the process is triggered every second. In order to present the data in a web interface, the HTML code incorporates a bootstrap accordion that is refreshed with new data on each update. The purpose of using an accor ...

Text wrapped automatically to display multiple lines with spacing between each highlighted line

Question about CSS formatting and spacing. I need to automatically break sentences into new lines based on the width of the container. For example, a sentence like: This is a sentence should be displayed as: This is<br>a sentence I am trying ...

Guide to solving the abnormal text input field issue on Mobile Safari

During my testing of the responsive design I'm developing for this project, I encountered an unusual bug with the text input field width that causes the window to shift to the right on Mobile Safari. This issue is puzzling me as it appears on all devi ...

Transforming HTML code into a structured object

The provided code snippet includes HTML markup that needs to be transformed into a specific format. <html> <head> <title>Hello!</title> </head> <body> <div class=”div1”> <h1>This is a ...

Is it possible to load images top to bottom?

Is there a way to make browsers load images from the bottom to the top? Imagine I have an extremely long image that takes 60 seconds to load. The content is designed to be read from bottom to top. Is there any trick I can use to ensure that the image load ...

Modify the color or background color of a disabled Material UI checkbox

The disabled unchecked checkbox appears too subtle to me, and I would like to enhance it by giving it a grey background and changing the cursor style to not-allowed. I've been trying to implement these styles on the checkbox using the makeStyles, but ...

Fixed positioning of a div causes it to move further away when zooming out

Greetings to all! I am looking to achieve a scrolling effect for a div area as I scroll down the page. To accomplish this, I have utilized the CSS property position:fixed to lock the div area within another div called "page". Below is the corresponding CSS ...

Align two divs with text in the center

I am having trouble centering two divs horizontally and aligning them between each other. The issue arises when I add text of different sizes in each div. Here is an example: http://jsfiddle.net/DgEcs/1/ Why does the red div move down and how can this be ...

When a user inputs a web or file address into a PHP form field, the result page will showcase a

My PHP database form is set up to gather user information, including a field for their website URL address. I want the result page to display the URL field as a clickable hyperlink. Can anyone advise me on how to achieve this? Many thanks! ...

Tips on how to remove the first column from a jQuery hover effect

Currently, I have a function that enables hover events on a table. Right now, it excludes the header row but I also need it to exclude the first column. Any suggestions on how to do this? $(".GridViewStyle > tbody > tr:not(:has(table, th))") ...

Displaying text over an image while hovering

Is there a way to display text over an image when hovered, without affecting the current text box effects? I need some assistance with this. * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; ...

Guidelines for removing the contents of a div upon clicking a radio button

When a radio button is clicked, the associated div with different input fields will be displayed. I am looking for a way to clear the contents of other divs when a new div is displayed. Any assistance on this matter would be greatly appreciated! ...

Incorporating user input into a div element

So, I'm in the process of building my own Task Tracker using JavaScript to enhance my skills, but I've hit a roadblock. I successfully implemented adding a new div with user-inputted tasks, however, there's no styling involved. <div cla ...

What is the best way to align a single row in the center and another row at the bottom using Bootstrap?

I'm struggling with aligning two rows within a section element that has a vh-100 height. The first row consists of 2 cols (headers, image, and dropdown) that I want to vertically align to the middle of the container. The second row just contains an i ...

Indicate the initial position of the scroll bar

Currently, I am working on implementing scrolling functionality and attempting to start it at a specific element based on a given id. This is how my html code looks like: <div class="list-wrapper" style="max-height:350px;overflow-y:scroll" > < ...

What is the best way to adjust a horizontal list of inline elements to stack vertically when the div container is resized?

Here is the issue I'm facing (notice how the yellow tiles are overflowing): (view image here) because my reputation points are not enough. The screenshot above illustrates how the small yellow rectangles are extending beyond the boundaries of the gr ...

Tips for aligning images within Bootstrap columns and using auto zoom to properly fill the space

Here is the code snippet for displaying images: <div class="row"> <div class="col-12"> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-12"> <div class=&qu ...

Struggling with the adaptability of my website's footer section

I'm facing a dilemma... No matter what I do, I can't seem to position my contact form over my Google iframe perfectly. It works fine if I don't mind sacrificing responsiveness, but as soon as I try to make it responsive, the absolute assign ...

Opacity for ghost images in HTML5 drag-and-drop interface

Is there a way to make the ghost image for draggable elements in Chrome render on a transparent background, similar to how Firefox does it? I'm seeing that in Chrome (Chromium 45), the ghost image is displayed on a white background. For Example: http ...