Varied results may occur across various browsers despite the use of reset.css

What causes different browsers to display the same website differently due to inline style?

Below is a snippet of CSS code:

.label-input, .label-input label, .label-input input , .label-input select , .label-input span {
float: left;
display: inline;
margin-left: 5px;
}

.label-input{
margin-right:5px;
}

.label-input label{
line-height: 25px;
display: inline-block;
width: 118px;
}

.label-input select{
margin-right: auto;
}

Visit this jsfiddle link for more details.

Answer №1

Make sure to add a clearfix after floating the elements. Apply the clearfix after each row.

CSS:

/**
 * @info Clearfix: clear all floated elements
 */
.clearfix:after {
    visibility:hidden;
    display:block;
    font-size:0;
    content:" ";
    clear:both;
    height:0;
}
.clearfix {display:inline-table;}

/**
 * @hack Display the Clearfix as a block element
 * @hackfor Every browser except IE for Macintosh
 */
    /* Hides from IE-mac \*/
    * html .clearfix {height:1%;}
    .clearfix {display:block;}
    /* End hide from IE-mac */

HTML:

// Row
<div>
    // Floated Div 1
    <div></div>
    // Floated Div 2
    <div></div>
    // ...
    // ...
    <div class="clearfix"></div>
</div>

// Row
<div>
    // Floated Div 1
    <div></div>
    // Floated Div 2
    <div></div>
    // ...
    // ...
    <div class="clearfix"></div>
</div>

Consider using Normalize.css for improved CSS consistency across browsers: . Normalize CSS resets styles and is well-maintained.

Answer №2

position: float;
visibility: inline;

This results in the following div being pushed up onto the previous line if there is enough space. Removing these properties should resolve the issue. Additionally, it's important to account for variations in font sizes among different browsers to ensure that labels display properly on one line across all platforms.

Answer №3

By implementing the clear:both property to the label-input field, the display has been corrected and now appears correctly on both browsers.

.label-input{
margin-right:5px;
 clear:both;
}

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

Revising a value that is influenced by the fluctuations of another value, and conversely

Currently facing a tricky issue with interdependent values in my code that I can't seem to resolve online. The problem lies in the fact that one value is affected by changes in another value, and vice versa. Here is a snippet of my code: <div cla ...

Steps to apply the nav-active class to a navigation using jQuery just once

Seeking assistance with a problem I am facing. I would like to add the nav-active class to an li element only once, meaning if a child element is selected, then the parent li should not have the nav-active class. Below is the code I am using, but it does n ...

Bootstrap failing to enclose columns that do not have a specified size

As I dive into creating a Bootstrap grid website to expand my knowledge, I am following the guidelines provided here. Trying to replicate the examples from that page has led me to the first hurdle. The issue arises when dealing with columns without specif ...

The tooltip is being truncated

https://i.sstatic.net/o41Qz.png Struggling with a tooltip that keeps getting cut off? I've tried everything and still can't get it right. <th class="fd-table--header-cell" scope="col"> <p class=&q ...

"Experiencing technical difficulties: Website not functioning properly on

I recently created this website. While it functions perfectly on desktop computers, I am encountering issues when trying to access it on mobile or tablet devices. My instinct tells me that the problem may be related to a large css animation on the homepa ...

Exploring the world of HTML and JavaScript through Java programming

When trying to read HTML content using Java from websites that contain JavaScript, my current app is unable to process the JavaScript. Is there a way to effectively retrieve and parse this type of content in Java? I'm also open to suggestions involvin ...

Verify whether the div already includes a particular item

I am currently working on an angular project where I need a button to add a blockquote within a div, but only if the blockquote is not already present in the HTML structure. My initial approach was to search for the specific string <blockquote id=&apos ...

Personalize the <img title> tooltip according to your preferences

I am curious about the possibility of customizing the tooltip that appears after setting the title attribute in an img tag. Currently, I receive a standard rectangle with a blue background and text, but I would like to have my own image (perhaps somethin ...

Changing class in jQuery ignores CSS style

I have a id="header" div that initially has css rule: padding: 25px 0;. I want to decrease the padding of this div when scrolling down the page. $(document).ready(function() { var headerID = $("#header"); $(this).scroll(function() { if (!$(this).s ...

How can a browser reload a document when navigating back to the previous page?

I am facing an issue with the browser's built-in go back function. Imagine I have two pages: Page1 and Page2. Page1 downloads a .json file and displays its contents on the webpage. On Page2, users can add new data to the .json file. However, if a ...

JavaScript: Choosing an element by class within the current row using jQuery

One of my tasks involves generating a table with values fetched from a database. The column totals are displayed at the end of the table. I am looking to provide users with the option to remove specific rows they do not wish to see, and have the total auto ...

Adjust the header and menu color as you scroll

Starting fresh with JavaScript, I'm seeking advice on a specific piece of code. Working on a Joomla 3.2 website using the Gantry template by default. My goal is to achieve the following: When a user accesses a submenu (e.g., 01, 02, 03) derived from t ...

Managing websites on Android when the keyboard is displayed

I am currently facing an issue with my webpage on Android (Galaxy SIII). The problem occurs when visitors try to enter their email in the form at the bottom of the page. The keyboard becomes visible, causing the design to look messy. When using Chrome, the ...

What could be causing my image to fail to load on Firefox while successfully loading on Safari and Chrome?

Can anyone explain why my image fails to load on Firefox but works fine on Safari and Chrome? .shape { border-radius: 25px; background: #4D5061; content: url(http://i1126.photobucket.com/albums/l611 ...

What is the best way to retrieve an object within an array using ng-repeat?

I'm encountering an issue with using ng-repeat in my development project. I am working with Ionic 2, utilizing TypeScript and HTML5. I have created an array of Objects where I need to access its attributes. The error message "cannot read property c.ge ...

Styling the Web with CSS in Django 2.0

I have a teammate who wrote some HTML code with CSS/Bootstrap. Now I am trying to render it in Django, but it's not displaying properly. It works fine as an HTML file, though. <meta charset="utf-8"> <meta name="viewport" content="width=devic ...

Do not allow numbers in the Vietnamese character set in the HTML pattern

I am looking for a RegEx pattern to validate the name field without allowing any numbers. Currently, my pattern allows numbers which is not what I want. [a-zA-Z'-ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèé ...

Unable to stack a div on top of a chart's div in HTML + (NV)D3 despite using a higher z-index value

I am facing an issue with my HTML and CSS code. Here is what it looks like: <div id="container"> <svg id="chart1"></svg> <div id='logo'> <img id="logo" src="cubs_best.png";> </div> </div ...

Icon for local system displayed on browser tab

I am currently trying to set a Browser Tab icon for the local system, but it is not working. However, when using an HTTP static icon, it works perfectly. Can someone please help me understand what the issue might be? PAGE 1 : Icon Not Showing <link re ...

Issue with the back-to-top button arises when smooth-scrolling feature is activated

This Back To Top Button code that I discovered online is quite effective on my website. // Defining a variable for the button element. const scrollToTopButton = document.getElementById('js-top'); // Creating a function to display our scroll-to- ...