The content within my "div class=content" is intersecting with the nav-justified section

My login page features a nav-justified list that allows users to connect using either a login/password or guest mode. However, I have encountered an issue where clicking on "Login" still displays the option for "Guest," and if I click on "Guest" again, it creates a loop.

HTML Code :

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/icon" href="{{ app.request.basepath }}/favicon.ico"/>
    <link rel="stylesheet" href="{{ app.request.basepath }}/css/main.css">
    <link rel="stylesheet" href="{{ app.request.basepath }}/css/templatemo_main.css">
<link rel="stylesheet" href="{{ app.request.basepath }}/css/bootstrap.min.css">
    <title>Nautilus - {% block title %}Authentication{% endblock %}</title>
</head>
<body>
<div class="container">
<h2 class="text-center">{{ block('title') }}</h2>
{% if error %}
<div class="alert alert-danger">
<strong>Error during authentication!</strong> {{ error }}
</div>
{% endif %}

<div class="row">
<div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<ul class="nav nav-tabs nav-justified">
<li class="active"><a href="#invite" data-toggle="tab">Guest</a></li>
<li><a href="#connexion" data-toggle="tab">Login</a></li>
</ul>
</div>
</div>

<div class="tab-content">
<div class="tab-pane fade in active connexion" id="invite">
<div class="container">
<div id="content">
<div class="well">
<form class="form-signin form-horizontal" role="form" action="{{ path('login_check') }}" method="post">
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<input type="text" name="_username" value="Guest" class="form-control" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<input type="password" name="_password" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-log-in"></span> Login</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

<div class="tab-pane fade connexion" id="connexion">
<div class="container">
<div id="content">
<div class="well">
<form class="form-signin form-horizontal" role="form" action="{{ path('login_check') }}" method="post">
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<input type="text" name="_username" placeholder="Enter your username" class="form-control" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<input type="password" name="_password" class="form-control" required placeholder="Enter your password">
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-log-in"></span> Login</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

<script src="{{ app.request.basepath }}/js/jquery.min.js"></script>
    <script src="{{ app.request.basepath }}/bootstrap/dist/bootstrap.min.js"></script>
    <script src="{{ app.request.basepath }}/js/Chart.min.js"></script>
    <script src="{{ app.request.basepath }}/js/templatemo_script.js"></script>

</body>
</html>

Image : Error

Answer №1

The issue lies within your HTML structure.

All the tab-pane divs should be placed within the div with class tab-content. The one with #connexion was mistakenly positioned outside.

Below is the corrected markup:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ app.request.basepath }}/css/main.css">
    <link rel="stylesheet" href="{{ app.request.basepath }}/css/templatemo_main.css">
    <link rel="icon" type="image/icon" href="{{ app.request.basepath }}/favicon.ico"/>
    <link rel="stylesheet" href="{{ app.request.basepath }}/css/bootstrap.min.css">
    
    </head>
    <body>
    <div class="container">
    
    <div class="row">
    <div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
    <ul class="nav nav-tabs nav-justified">
    <li class="active"><a href="#invite" aria-controls="profile" role="tab" data-toggle="tab">Invité</a></li>
    <li><a href="#connexion" aria-controls="profile" role="tab" data-toggle="tab">Connexion</a></li>
    </ul>
    </div>
    </div>

    <div class="tab-content">
             
    <div role="tabpanel" class="tab-pane fade in active connexion" id="invite">
    <div class="container">
    <div id="content">
    <div class="well">
    <form class="form-signin form-horizontal" role="form" action="{{ path('login_check') }}" method="post">
    <div class="form-group">
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
    <input type="text" name="_username" value="Invite" class="form-control" required>
    </div>
    </div>
    <div class="form-group">
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
    <input type="password" name="_password" class="form-control">
    </div>
    </div>
    <div class="form-group">
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
    <button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-log-in"></span> Connexion</button>
    </div>
    </div>
    </form>
    </div>
    </div>
    </div>
    </div>

    <div  role="tabpanel" class="tab-pane fade" id="connexion">
    <div class="container">
    <div id="content">
    <div class="well">
    <form class="form-signin form-horizontal" role="form" action="{{ path('login_check') }}" method="post">
    <div class="form-group">
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
    <input type="text" name="_username" placeholder="Entrez votre login" class="form-control" required>
    </div>
    </div>
    <div class="form-group">
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
    <input type="password" name="_password" class="form-control" required placeholder="Entrez votre mot de passe">
    </div>
    </div>
    <div class="form-group">
    <div class="col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
    <button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-log-in"></span> Connexion</button>
    </div>
    </div>
    </form>
    </div>
    </div>
    </div>
    </div>

    </div>
    
    
    </div>

    <script src="{{ app.request.basepath }}/js/jquery.min.js"></script>
    <script src="{{ app.request.basepath }}/bootstrap/dist/bootstrap.min.js"></script>
    <script src="{{ app.request.basepath }}/js/Chart.min.js"></script>
    <script src="{{ app.request.basepath }}/js/templatemo_script.js"></script>

    </body>
    </html>

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

Error 19: Constraint violation - duplicate entry detected

While trying to set up my app, create a local database, and insert the very first user who has logged in locally, I encountered an error message at a specific point in the code. Here's where it happened: angular.module("greenApp") .service("d ...

Building a Div Tag Layout with CSS for Full Width and Left Position of 300px

Experiencing some trouble with styling a div element. My goal is to have the div start at left:300px and stretch across the entire width of the browser window. However, when I apply width:100%, the div extends beyond the boundaries of the browser screen. ...

The JSON file containing API data is stored within the _next folder, making it easily accessible to anyone without the need for security measures or a login in the Next

When accessing the protected user Listing page, we utilize SSR to call the api and retrieve all user records which are then rendered. However, if one were to check the Network tab in Chrome or Firefox, a JSON file containing all user data is generated and ...

Exploring ways to create additional file upload fields with distinct names through JavaScript

My latest project involved creating a button that allows users to add a file upload field, a separate button to remove a file upload field, and a counter to keep track of the total number of file upload fields. However, it appears that the fields are not b ...

Tips for shifting the cursor slightly to the right within an Input field

I created a div with an input field inside. I set the input field to autofocus, so when the page loads, the cursor is automatically focused on the input field. However, the cursor is touching the border of the input field, making it hard to see clearly. ...

Converting Fancy Text to Plain Text using Javascript: A Step-by-Step Guide

I am currently developing a search feature in JavaScript that supports both regular and fancy text styles. However, I have encountered an issue with the search functionality not working when searching for: Fancy text value: ...

Issue with arranging cards in a grid when utilizing v-for alongside bootstrap

Just starting out with vuejs and attempting to create a grid by looping through objects using bootstrap classes. However, I'm running into an issue where the cards are not forming a grid as expected when utilizing the col classes. Below is the code f ...

The commands 'npm run watch' and 'dev' are no longer functioning on my computer for my Laravel project. I am encountering an error stating: '[webpack-cli] RangeError: Maximum call stack size exceeded'

Recently, while working on a Laravel website, I've been focusing on writing JavaScript code to integrate Meilisearch. To facilitate this process, I incorporated the 'dotenv' library with node to access variables from my .env file for securit ...

Create a section and a div with a set size in HTML

I'm having trouble setting the height of a div within a section to 100px. Despite my efforts, the height keeps reverting back to 'auto' and adjusts based on the content inside the div. Below is the HTML code: <section id="social" class= ...

Find all paragraphs with the CSS property "background-color" using JQuery

My task involves modifying the CSS of a paragraph tag that has a background color of #aaddff. The code I have written seems to be missing something, as the border is not appearing as expected. Should I use element.style or is there a different approach I ...

When utilizing jQuery events, ensure to pass along parameters when context is changed

I am working with the following simple code: app.Modules.myModule = { init: function(){ this.bindEvents(); }, bindEvents: function(){ app.Events.on('user:added', this.userAdded.call(this)); this.username = $( ...

Is it impossible to access the length property of an undefined variable?

After developing a function that calculates the length of a string entered into an HTML textbox, I encountered an error when trying to display the result in another textbox. The function is designed to get the value from the 5th textbox on my HTML page and ...

Tips on Moving a Bootstrap Modal Popup with the Arrow Keys on Your Keyboard

This example showcases the integration of Bootstrap's Default Modal Popup with jQuery UI Draggable Function. The JS fiddle link provided below contains the code snippet. $(document).ready(function() { $("#btnTest").click(function() { $(&a ...

Tips for sequentially arranging and rearranging an array of numbers, even when duplicates are present

Encountered a perplexing issue that has me scratching my head in an attempt to visualize a solution. Currently, I am working with an array of objects that appears as follows: let approvers = [{order:1, dueDate: someDate},{order:2, dueDate: someDate}, ...

Issue with Google Finance JSON response not functioning as expected in Chrome and Firefox browsers, yet appears to be working properly in

I am currently working on a JavaScript project that involves fetching STOCK data from the Google Finance API. When I manually paste the link into my browser, I can successfully retrieve the JSON response: // [ { "id": "22144" ,"t" : "AAPL" ,"e" : "NASDAQ ...

Press the mouse button to position the camera close to an element in Three.js

Trying to implement a click to zoom feature with Three.js, I have a canvas and an object loaded in it. When clicking, I want to position the camera near the point of intersection for a zoom effect. Here is my current code, but it's not working as exp ...

The value is undefined until a new Resource object is pushed with the item

I've encountered an issue while testing a factory and I can't seem to find anyone else with the same problem. Can someone help me figure out what's causing this strange error? TypeError: 'undefined' is not a function (evaluating & ...

CSS can be used to strategically place elements on a webpage

I am currently in the process of learning and I am facing some challenges with CSS. My goal is to centrally align all items within a div, as well as align pictures with text and have everything aligned to the left. HTML <div class='SectionTop ...

CSS alone has the power to make multiple elements react to a hover action on a div

Is there a way to dynamically change the size of multiple div elements on hover? In this example, we can see how one div element's size changes when hovering over another div element: https://jsfiddle.net/9510a6kj/ .left, .right{ float:left; ...

Finding an element based on its styling attribute, such as its position on the left or right side

One particular block that caught my eye is the slider element: <div id="sliderDispo" class="slider slider-dispo" data-slider-init="" data-slider-color="#0077b5 #EC6E31 #E40B0B" data-slider-step="33" > <div class="slider__interval" ...