Expand your view to avoid overflow

Take a look at this image

When viewing with standard resolution (1386 x 788), everything looks fine. However, when attempting to zoom out in Internet Explorer, things get messy:

Why does this happen and how can it be fixed? Here's the code causing the issue:

#pages{
    width: 190px;
    height: 100px;
    border: 1px solid black;
}

.p {
    float:left;
    width: 100px;
    height: 100px;
}

.i {
    float: right;
    width: 80px;
    border: 1px solid black;
}
<div id="pages">
    <img class="p" src="a.jpg"/>
    <div class="i"> Lorem... </div>
</div>

Answer №1

Check out this CSS snippet:

#container{
width: 200px;
height: 150px;
border: 2px solid black;
position:relative;
}

.item{
width: 100px;
border: 1px solid black;
position:absolute;
right:0;
}

Apply the position attribute to #container and use absolute positioning for the class .item. Make sure to remove the float:right property from the .item class before testing it out.

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

The issue of the highlighted row not disappearing persists even after clicking on the adjacent table row

When selecting the gear icon for the menu option in a table row, I would like the background to turn yellow. I attempted the following code to highlight the table row: var view = Core.view.Menu.create({ model: model, menuContext: { ibmm: ibmm }, ...

Create an HTML document with a bottom section that shows up on every page when printed

I am currently working on creating a footer for an HTML file where the requirement is to have the footer displayed on each printed page. I came across a solution that fixes specific text to every page that I print. Here is the code snippet: <div class ...

Is the table scrollable within the tbody tag?

Is it possible to create a table with a scrollbar on the right side using only CSS and without any plugins like jQuery? Additionally, I want the table header to remain fixed in place. What steps do I need to take to achieve this functionality? ...

Update the font style of the navigation bar

Hey there! I recently downloaded a template from this website: . However, I'm facing an issue with the nav bar displaying strange fonts when using Vietnamese letters. For example, "Nước" shows up as all uppercase and the letters "uo" are shortened. ...

Having an issue with Local Storage returning undefined

I've been working on a form to input values and show the data on a different page after submission. Below is my form: <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" hr ...

What steps can be taken to prevent a wrapper's CSS from affecting its enclosed elements?

My container div includes some opacity and auto height that I don't want to affect all elements within it. Is there a way to preserve the container's styles without impacting its contents? ...

Which one has better performance: class or CssClass?

Curious about the efficiency of: <asp:TextBox runat="server" class="someCssClass"></asp:TextBox> as opposed to. <asp:TextBox runat="server" CssClass="someCssClass"></asp:TextBox> I speculate that class is quicker than CssClass s ...

Steps to dynamically update a button's href based on the active status of a class

I am facing a challenge in using Js and Jquery to dynamically change the href of a button based on the presence of a specific class. I am relatively new to Javascript and unsure if I am approaching this problem in the best way. Any suggestions on how to re ...

Calculation operations nested within each other

Looking for a solution here. I am trying to utilize the CSS calc operation to carry out two calculations: I aim to make my width equal to (100% / 7) - 2 But whenever I attempt multiple operations in a CSS calc function, it doesn't work: width: cal ...

When using JSON.Stringify in a React App, it only displays the first item and the length of the object instead of all the other items

Working on a React App, I encountered an issue while trying to convert an array to JSON and send it to the server. My approach was like this: console.log(JSON.stringify(mainArray)) I anticipated seeing output like this during testing: "breakfast": { ...

I'm still unclear on the necessity of using clear:both

Presenting a simplified example of my previous query, I am still seeking clarification regarding the necessity of using clear:both to enable padding-top. Can someone provide a straightforward illustration to elucidate the usage of float and clear? Hence, ...

Images Centerfold Team

I am facing a challenge in creating a group of images for an album. There seems to be a significant gap on the right side, which cannot be resolved without using padding. However, adding padding only works for my current PC resolution and creates a larger ...

Steps for creating a border around a container Div:1. Set the width and

Seeking assistance in bordering a div with 4 fa-icons inside. The parent div is named Container, and as a result, the border is creating excessive padding on the left and right sides horizontally. Attempted nesting bootstrap grids without success. Can anyo ...

Using an HTML and PHP form to store data in the database, it currently defaults to entering "0000-00-00" for the date instead of the date chosen

Recently, I encountered an issue with inserting date information from an HTML form into a database using a PHP file. The HTML form included a date field with an HTML5 datepicker that was supposed to simplify date selection. However, despite adjusting the P ...

Despite applying a CSS reset in the modal, the margin-bottom property is still being recognized in Chrome but not in Firefox

Here is a snippet of CSS code that I am currently working with: * { margin: 0; padding: 0; } body { overflow-x: hidden; margin: 0; padding: 0; } .modal { display: none; position: fixed; z-index: 1; left: 0; top: 0; right: 0; bott ...

Add some flair to your list by animating the text within it

My goal is to add animation to the text within the list. Below is the code snippet: <div id="about" class="row section"> <div class="col-sm-8"> <h2 style="color:black;">About me!</h2> <ul> <li > ...

Adding a logo to a website that utilizes CSS, HTML, JS, and Bootstrap

Hey there! I'm new to the world of Front-end development and I've been learning by watching videos and reading everything I can find on the Internet. Currently, I'm using HTML, CSS, and JS for my website. Can anyone help me figure out how to ...

Synchronize scrolling between two elements to create a dynamic user experience

I'm currently facing an unusual situation. Take a look at the following image: Link to image So, I have this ruler positioned at the top. To prevent it from scrolling off when I vertically scroll the content, I placed it outside the scrolling contai ...

Looking to modify the contents of a shopping cart by utilizing javascript/jQuery to add or remove items?

I'm dealing with a challenge on my assignment. I've been tasked with creating a Shopping Cart using Javascript, HTML5, and JQuery. It needs to collect all the items from the shop inside an Array. While I believe I have most of it figured out, I a ...

How can you execute PHP code within another PHP script without triggering a redirect?

I'm faced with a situation where I have two php files, namely abc.php and def.php. My goal is to only display abc.php in the browser URL bar when it executes. Additionally, upon clicking the submit button on my HTML page, abc.php should be triggered t ...