Odd floating and positioning behavior observed in IE7

Looking for help with this code:

<div class="container">
    <input type="submit" name="submit" class="submit" value="Sign Up">
</div>

Check out the CSS styling:

input.submit{
    padding-left: 40px;
    padding-right: 40px;
    float:right;
}
.container{
    background-color: #AAA;
    float:right;
    padding: 50px;
}

The goal is to have the div wrap around the input button, float to the right, and be sized to match the button's size plus padding (50px). Everything works fine in other browsers but there are a couple of issues in IE7:

  1. The div width stretches to cover the entire page. Removing float:right from input.submit fixes this issue.
  2. The input button width is larger than expected compared to other browsers.

This is the doctype being used:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

If you know why these problems are occurring and how to solve them, please share your insights!

Answer №1

Removing the float: right on input.submit may not be necessary unless there is a specific reason for it. If you encounter any issues, feel free to show me so we can find a suitable workaround.

To address the second problem, consider adding overflow: visible to input.submit.

Upon implementing these changes, you should notice a similar appearance in both IE7 and IE9. Check out the comparison here: http://jsfiddle.net/33vmm/

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

Step-by-step guide on creating a linear graph in CSS using a table

I am a newcomer to the world of CSS and I am looking to create a graph using CSS without the use of any libraries or frameworks. Can someone kindly assist me in drawing a linear graph using this HTML table? Appreciate any help in advance. <html> & ...

What is the best way to combine percentage and pixel values for setting a max-width?

Is there a way to limit the width of a div so that it does not exceed either a percentage or pixel value? I want the browser to calculate the pixel equivalent of the percentage and then choose the smaller value. For example, if I set both values like this ...

Achieving alignment of the label with the top of the div

I'd like to align a label with a div vertically, but I'm having trouble. Take a look at the picture below to see what's happening. The corrections in blue show what I want it to look like. I've included the relevant HTML and CSS below, ...

Creating a CSS-only carousel - Ensuring its correctness (especially in terms of height)

Just stumbled upon this amazing CSS-only carousel. Any hints on how I could make it responsive and display two carousels side by side? Click here to view the carousel. /* ***************************************************** */ /* SLIDER 1 */ /* ****** ...

Combine one CSS property in Emotion

Having some trouble creating reusable animations with Emotion. I've defined a fadeUp animation that works well: export const animatedFadeUp = css` opacity: 1; transform: translateY(0); `; export const fadeUp = css` opacity: 0; transform: tran ...

The Gulp task is not being recognized when I open the project in Visual Studio Code

Whenever I open gulp, I encounter an error related to minifying css and js files using gulp tasks. Despite my efforts to find a solution, the problem remains unresolved. Error Message: assert.js:374 throw err; ^ AssertionError [ERR_ASSERTION]: Task fu ...

Assign a background image to a master page utilized in subdirectories

In my website's root directory, I have a master page. Inside this root directory, there is a folder named Images which contains the background image for my master page. When I apply this master page to web pages located in the root directory, everythi ...

Ways to display or conceal text based on chosen options from a select box without using javascript

Is there a way to display different text based on selection from a dropdown menu without using javascript? I attempted the code below, but it still relies on the onchange event. <div> <select onchange="if(selectedIndex!=0)document.getElement ...

Guide to positioning an image at the center across 2 columns using Bootstrap

Looking to create a split screen Bootstrap 4 layout with an image in the center overlapping the two columns. Have successfully set up two equal columns but struggling to position the image to overlap. Have experimented with position:absolute and float:lef ...

Struggling to figure out the best way to position logo and navigation next to each other using CSS grid

I'm currently working on aligning a logo and navigation bar in a single row at the top of a website using CSS grid. After writing the code, I'm having trouble figuring out why it's not functioning as intended: https://codepen.io/chloewb/pen ...

Ensure that the div elements fully occupy the remaining space within the box

I'm looking to bring this idea to life: https://i.sstatic.net/SWytj.png Most of my work is complete, but I need the boxes to fill up all available space in the row. This is the HTML code I've used with Bootstrap. How can I achieve this? < ...

Troubleshooting: Why is Jquery unable to retrieve image height?

Having trouble using jQuery to find the actual height of the first image nested within a container. I can access the src attribute but not the height. Any suggestions on how to get the accurate height? Is it necessary to retrieve heights via CSS? Unfortu ...

Modern gallery of adhesive art pieces

Lately, it's becoming more common to come across websites with galleries like the ones found here: (check out the gallery) I find these galleries quite appealing and I'm interested in incorporating something similar on my own website. However, ...

Can Bootstrap be used to display a customized navbar on specific devices, while showing a different navbar on smaller screens?

Hello everyone, I have a quick and specific question. Currently, I have created a custom navbar (see image below). However, I want this navbar to be deactivated when the screen size is too small and instead show a regular navbar at the top. Is it achievabl ...

Issue with linking CSS file to EJS file in Express.js

After carefully reviewing the setup of my folders and code structure, I am confident that I have correctly linked the CSS to the EJS file. Despite this, I am still facing issues as it is not working properly. To provide a visual reference, I have include ...

Tips for concealing and substituting the navbar-toggler-icon in Bootstrap 4

Is there a way to hide and replace the navbar-toggler-icon in Bootstrap 4? Currently, the code I have just displays an 'X' below the hamburger menu. <nav class="navbar navbar-toggleable-md"> <button class="navbar-toggler navbar-toggle ...

Explain the concept of grid layout in CSS

Can you please clarify the distinctions between grid and liquid layouts? Specifically, I am interested in understanding the concept of a grid layout. Thank you in advance for your explanation. ...

"jQuery Hide-and-Seek: A Fun Way to Manip

I am facing a challenge with a set of divs that I need to dynamically show and hide based on user interactions with questions. Essentially, the user will be presented with a question. Based on their answer, specific content with a title and description wi ...

Is it possible to generate distance between 2 elements without utilizing padding or margin?

In my React Native project, I'm currently working with 2 inline buttons - the search and add buttons: https://i.stack.imgur.com/tKZrf.png I'm looking to add some spacing between these buttons without impacting their alignment with the left and ...

Tips for inserting a button under a div when clicked

I am working on a layout where I have several div cards aligned side by side using the display: inline-block property. What I want to achieve is that when I click on a card, a button is added below the respective div. To accomplish this, I tried using jqu ...