Move the close button on Bootstrap's Modal to the left side

I am currently in the process of building a new website and I am still learning HTML, CSS, and other related technologies. I am utilizing Bootstrap to assist me, but I have run into a problem. The website I am working on is in Hebrew and I am struggling to move the X button in the Bootstrap modal to the left side of the window.

I have attempted to use the float property with a value of left and also tried inline styling, but neither approach seems to be working.

<!-- Sign In Button -->
      <div class="container buttons">
        <a class="btn btn-light download " data-toggle="modal" data-target="#Sign-In-Modal">התחברו</a>
        <!-- Sign In Button Modal -->
        <div class="modal fade" id="Sign-In-Modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">התחברות</h5>
            <button type="button" class="close pull-left" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body" style="text-align: right;">
            .הכנס שם משתמש וסיסמא בכדי להתחבר
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" style="float: left;" data-dismiss="modal">סגור</button>
            <button type="button" class="btn btn-light" style="background-color: #e3f2fd; float: left;">התחבר</button>
          </div>
        </div>
      </div>
    </div>

My desired outcome is to have the Modal Title on the right side while the X button is on the left side of the window. Any assistance would be greatly appreciated.

Answer №1

To achieve this effect, simply adjust the sequence of the button and h5 elements, and modify the auto margin for modal-header .close.

Another reliable solution suggested by @daryll is to utilize bootstrap-rtl:

.modal-header .close {
    padding: 1rem 1rem;
    margin: -1rem auto -1rem -1rem;
}
<h5 class="modal-title order-2" id="exampleModalLabel">התחברות</h5>
<button type="button" class="close order-1" data-dismiss="modal" aria-label="Close">
   <span aria-hidden="true">×</span>
</button>

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

Finding the webpage URL where a form element is located

Suppose I have two pages called a.php and b.php, each with a form-tag. Both of these forms have the same action attribute set to c.php. Is there a way to determine in c.php which form (from either page a or b) triggered its submission? Using a hidden inpu ...

choose the li element that is located at the n-th position within

Need help with HTML code <div class="dotstyle"> <ul> <li class="current"><a href="javascript:void(0)"></a></li> <li><a href="javascript:void(0)"></a></li> <li><a href="javasc ...

Tips on pausing a moving image from left to right and restarting it later

Is there a way to pause the left to right moving image at the end and then restart the loop? I tried utilizing this website link for assistance: https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_animation-delay Unfortunately, I couldn't fi ...

How can I dynamically change the orderBy parameter based on conditions in an Angular application?

I need to dynamically change the orderBy parameter in a table row based on the result of a method. Here is an example of my current tr setup - <tr class="pl" ng-repeat="thing in things | orderBy:'oldId':reverse" ng-class="{'row-error&apo ...

Objects and strings cannot be inserted into a JavaScript array

For hours, I've been attempting to troubleshoot this code. Currently, it successfully finds the number of anchors, and I have an array that is of undetermined size. Within the for loop, it retrieves the anchor and extracts the .href. I've confirm ...

Adding breakpoints and whitespace in the comment section within Python's Django framework

Update 2 I attempted to implement the <div class="row"> from Bootstrap but the comments continued to display in columns instead of rows. https://i.stack.imgur.com/EMYB2.png <article class="media content-section"> <!-- comments --& ...

Converting user's birthdate input from HTML to their age using PHP

I am facing an issue with retrieving the correct date from a date-time-picker named "dob" and passing it to PHP. When I try to post the date into the database user_age column, it only displays '2017'. However, if I manually set $dob to '10/0 ...

Randomly swap images in HTML when a button is clicked

In order to change images randomly on mouse click, I came across this solution: <SCRIPT LANGUAGE="Javascript"> function banner() { } ; b = new banner() ; n = 0 b[n++]= "<A HREF='index.html'><IMG SRC='images/pic1.jpg'> ...

Eliminate billing information from the Woocommerce order management page on the backend

Is there a way to modify the text "Paid on" in the backend order details page of WooCommerce? I have already implemented this for BACS and local pickup payment methods. Replace a specific word for BACS payment method in Woocommerce order edit pages I am ...

How can I use CSS to ensure that both cards and images are equal in size?

I am currently utilizing react, with Material-ui being used for the Cards. For the layout, I have implemented CSS Grid Layout for the Grid system. Presently, the structure looks like this: https://i.stack.imgur.com/0FDyY.png However, my desired outcome i ...

Utilizing WordPress to dynamically update the footer content on a targeted webpage by modifying the HTML/PHP/JS code

Let me provide some clarity. Details: - Website built on WordPress This website is bilingual with Hebrew and English languages. The issue is with the footer section. I have 4 lines that need to display: - Address: ........ - Phone: ....... - Fax: ...... - ...

How can I fetch and reference multiple local JSON files in Vue using Axios?

I am currently utilizing vue for prototyping some HTML components. Is there a method to make Vue detect two separate JSON files? vue.js var vm = new Vue({ el: '#douglas-laing', data: { products: [], contentPanels: [] }, created() ...

Retrieving text content from an HTML tag using C#

I'm working with a variable that contains the following tag. My goal is to extract the values of type and id into separate variables using C#. What is the most effective approach to accomplish this task? <a href="gana:$type=FlexiPage;id=c828c4ea- ...

Unlock the power of nested dynamic content creation with JavaScript

Every time I attempt to use getelementbyid on a dynamically loaded div, I receive null as the result. This occurs even after trying both window.onload = function () { and $(window).load(function() { index.html: <main > <div id="main-div"> ...

Is it one form but with two buttons?

How can I identify which button was clicked in a form without using a hidden input field and JavaScript to set different values for each button? You can check out an example demonstrating this technique here: Is there a more straightforward way to achiev ...

What is the process of incorporating a video into a react.js project through the use of the HTML

I'm experiencing an issue where my video player loads, but the video itself does not. Can anyone shed light on why this might be happening? class App extends Component { render() { return ( <div className="App& ...

Tips for changing the color of an underline in an <a> tag when it is hovered over

Is it possible to change the color of the underline in an <a> tag when hovering over it? After some investigation, it seems that direct color changes are not feasible. Instead, you can use the border-bottom option. However, my attempt did not yield ...

Display a preloader image while waiting for the content to load using jQuery or AJAX

Hey there, I could really use some help with a little issue. I've been trying to use the click() and load() functions to bring my content into a specific CSS class. $("#feed").click(function(){ $(".homefeed").load("feedcontainer.php"); ...

Adjusting the quantity of buttons in real-time following an ajax request

Creating buttons dynamically in an Ajax success function can be a challenge when the number of buttons varies each time. I am able to create the buttons, but since the exact number is unknown, adding the correct number of button listeners becomes tricky. ...

Position a div in the center and add color to one side of the space

I am seeking a way to create a centered div with the left side filled with color, as shown in examples. I have devised two solutions without using flexbox, but both seem somewhat like hacks. body { margin: 0; padding: 0; } .header { width: ...