I am experiencing an issue with the display inline feature not functioning properly in Firefox

I am working with Html code:

            <div class="login">
            <form class="form-horizontal signin">
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">Email : </label>
                    <div class="col-sm-5 more">
                        <input type="email" class="form-control top" id="emailLogin" placeholder="Email" size="100">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">Password : </label>
                    <div class="col-sm-5 passLog">
                        <input type="password" class="form-control" id="passwordLogin" placeholder="Password">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">Sign in</button>
                    </div>
                </div>
            </form>
        </div>

Additionally, I have included the following jquery code:

$(".signin").submit(function(){
    $('.error').remove();
    var hasError = false;
    if($.trim($("#emailLogin").val())=="")
    {
        $(".more").append('<span class="glyphicon glyphicon-remove error" role="alert"></span>');
        hasError = true;
    }
    if($.trim($("#passwordLogin").val())=="")
    {
        $(".passLog").append('<span class="glyphicon glyphicon-remove error" role="alert"></span>');
        hasError = true;
    }
    if(hasError == true)
        return false;
    else
        return true;
});

However, I am facing an issue where the span elements are displayed as block structures instead of inline. To resolve this, I need to add the following css property:

display:inline;

This works fine in Chrome but does not render correctly in Firefox.

Answer №1

It seems like you are utilizing Bootstrap in your code snippet based on the class names present.

Furthermore, it appears that you are attempting to include an icon to signify a certain validation state.

The great news is that this functionality is already integrated into the Bootstrap framework:

http://getbootstrap.com/css/#forms-control-validation

To accomplish this, ensure to incorporate additional Bootstrap class names as detailed below:

  1. Add the class name form-control-feedback in the span element being appended to the DOM through jQuery.

  2. In the .form-group sections, append the classes has-error has-feedback

  3. Verify that the id values correspond with the respective values in the for attributes linking your label and input fields together

$(".signin").submit(function(){
    $('.error').remove();
    var hasError = false;
    if($.trim($("#emailLogin").val())=="")
    {
        $(".more").append('<span class="glyphicon glyphicon-remove error form-control-feedback" role="alert"></span>');
        hasError = true;
    }
    if($.trim($("#passwordLogin").val())=="")
    {
        $(".passLog").append('<span class="glyphicon glyphicon-remove error form-control-feedback" role="alert"></span>');
        hasError = true;
    }
    if(hasError == true)
        return false;
    else
        return true;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw=="
crossorigin="anonymous">
<div class="login">
  <form class="form-horizontal signin">
    <div class="form-group has-error has-feedback">
      <label for="emailLogin" class="col-sm-2 control-label">Email :</label>
      <div class="col-sm-5 more">
        <input type="email" class="form-control" id="emailLogin" placeholder="Email">
      </div>
    </div>
    <div class="form-group has-error has-feedback">
      <label for="passwordLogin" class="col-sm-2 control-label">Password :</label>
      <div class="col-sm-5 passLog">
        <input type="password" class="form-control" id="passwordLogin" placeholder="Password">
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-default">Sign in</button>
      </div>
    </div>
  </form>
</div>

Answer №2

To achieve the desired result, just include the following CSS code:

 display: -moz-inline-stack;
        display: inline-block;
        vertical-align: top;

in place of:

display:inline;

for more information, check out this link.

Answer №3

width:85%;
display:-webkit-inline-box;

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

Tips for transmitting multiple parameters using PHP via AJAX

Welcome to my page where I have a specific functionality that needs to be implemented. What I am looking for is, when the user clicks on the "accept" button, the "accept" function should be called with unique parameters attached to each row. Below is the ...

Convert the HTML content into a PDF while retaining the CSS styles using either JavaScript or Django

Looking to create a PDF of an HTML element with background color and images. Seeking a solution, either client-side or server-side using Django/Python. Tried jsPDF on the client side, but it does not support CSS. Considering ReportLab for Django, but uns ...

Utilize JQuery's appendTo() method along with html() function for seamless content replacement

I have a question about appending and replacing div elements. I am currently using the following code: $('.toggle_questions').appendTo('#'+sectionId).show(); While this works perfectly to append my div with the class .toggle_questions ...

How can I use JavaScript to retrieve information from a different webpage?

I am trying to extract data from another webpage using JavaScript, jQuery, or Ajax without using PHP. I came across a helpful example on Stack Overflow (link here). However, when I implement these codes in my index.html file, it doesn't seem to work. ...

Scrollbar in an HTML selection tag

Is there a way to add a scroll bar to an HTML select box without using JavaScript? Alternatively, is there a JavaScript library that can achieve this behavior? Also, I'm looking for a redesign of the interface where I have two select boxes and items ...

Issues with LESS rendering on the Django production server

After deploying my Django website to the production server, I noticed that the LESS file is being loaded but not rendered. Strangely, everything works perfectly on the local server. Any insights on why this might be happening? ...

Explore button that gradually decreases max-height

I have a "Show More" button that expands a div by removing the css attribute max-height, but I want to add an animation similar to jQuery's slideToggle() function to smoothly reveal the rest of the content. This is the code I am using: <div id="P ...

Div element failing to scroll with excessive content

I'm currently working on a modal using Mui Modal and I've encountered an issue. Everything seems to be functioning correctly until I add more items to the cart. When the minHeight exceeds 500, it stops at 100vh and only displays 5 items, even if ...

Utilizing LocalStorage in conjunction with the redux state management

Currently, I am working on a single-page application using React and Redux. I have encountered the need to store certain data locally and ensure that it remains synchronized with the appState in local storage, even after a page refresh. Despite being new ...

Bootstrap's landing page problem

I am currently working on creating a landing page using bootstrap and have encountered an issue with the text alignment in my section containing icons and tags. In order to make the text appear clean and concise, I want the text to be displayed in either o ...

Execute a function upon pressing the enter key

Currently, I am working on coding a webpage with a form that includes one field where users input a set of numbers. After typing in the numbers, they should then press a button labeled 'Run' to execute the code. However, the issue arises when use ...

Performing Jquery functions on several elements at once

Looking at the code snippet below, there are two buttons and an input in each container. The input calculates and adds up the number of clicks on the 2 buttons within the same container. However, it currently only works for the first container. How can thi ...

"Improve text visibility on your website with Google PageSpeed's 'Ensure text remains visible' feature, potentially saving you

Click here for the image reference showing the 0ms potential saving message I'm having trouble with a warning in Google PageSpeed and I've tried everything. This is the code I'm using to define the font-family: @font-face { font-family: ...

Ways to conceal a div element when the JSON data does not contain a value

If the value in "desc" is empty, then hide <div24> and <popup-desc>. html <div class="popup"> <div class="popup-top" style="background-color: '+e.features[0].properties.fill+';"> ...

Using JavaScript to invoke Applescript commands

Is it feasible to execute Applescript from JavaScript? I would be grateful if someone could offer a sample code or useful reference link. ...

Enable the bottom footer to expand along with the content to support a dynamically growing page

I followed a tutorial on keeping footers at the bottom of a webpage (http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page) to create a site with a fixed footer. However, I encountered an issue when there is more content than can fit ...

Changing the Input Label Color on Hover in Material-UI TextField

I have a custom styled Mui TextField called CustomTextField. It changes the input background color and font color on hover, but I also want to change the label font color when hovered over. Currently, the input background changes from black to white on hov ...

When you reach a scrolling distance of over 300 vertical heights,

Is it possible to show and hide a class based on viewport height? I am familiar with displaying and hiding a class after a specified pixel height, but I'm wondering if it's achievable using viewport height instead? Specifically 3 times the viewp ...

Adding a code for divs into CSS caused the navigation bar to be completely obliterated

Initially, my menu was perfectly styled with the following CSS code in my css file: ul.Menu { list-style-type: none; margin: 10px; overflow: hidden; background-color: #ffffff; border-style: solid; border-color: #e9055c; border-width: 2px; font-weight: bol ...

Why is my HTML image stored in the database not showing up in TCPDF?

Currently, my situation involves using TCPDF to retrieve content from a MySQL table row that contains HTML code like this: <p><a href="x.html"><img src="http://1/2/3/x.jpg" width="x" height="x"></a></p> The problem arises wh ...