Tips for aligning content to the right edge

Within a container class, I have a background image set up and divided it into col-6. The first col-6 is currently empty. However, my goal is to add content on the right side of this column. I attempted to achieve this by adding the justify-content-end class but unfortunately, it did not work as expected. This resulted in the layout shown here: what I did. What I actually want to display is demonstrated here: what I expected.

<div class="main-contact">
            <div class="container">
                <div class="col-6">
                </div>
                <div class="col-lg-6 col-12 justify-content-end">
                    <div class="main-about-content">
                        <h3>Hayal Ettiğiniz Mobilya ile </h3><br>
                            <span>
                                Bahçenizi Tamamlayalım.
                            </span>
                        <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
                            laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
                            architecto beatae vitae dicta sunt explicabo.</p>
                        <a href="iletisim.html">Detaylı Bilgi</a>

                    </div>
                </div>
            </div>
        </div>

.main-contact {
background-image: url(../img/Asset6.png);
background-size: cover;
background-repeat: no-repeat;
   }


.main-about-content {
        background-color: rgb(255,255,255, 0.3);
       color: white;
       padding: 65px 40px;
       text-shadow: 0 0 10px black;
     }

Answer №1

Try incorporating an offset into your design.

.main-contact {
  background-image: url(https://images.theconversation.com/files/393210/original/file-20210401-13-z6rl6z.jpg?ixlib=rb-1.1.0&rect=9%2C0%2C2994%2C1999&q=45&auto=format&w=496&fit=clip);
  background-size: cover;
  background-repeat: no-repeat;
}

.main-about-content {
  background-color: rgb(255, 255, 255, 0.3);
  color: white;
  padding: 65px 40px;
  text-shadow: 0 0 10px black;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f7959898838483859687b7c2d9c6d9c7">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<div class="main-contact">
  <div class="container">
    <div class="col-6">
    </div>
    <div class="offset-sm-6 col-sm-6 justify-content-end">
      <div class="main-about-content">
        <h3>Enhance Your Space With Custom Furniture</h3><br>
        <span>
          Let Us Complete Your Garden.
        </span>
        <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</p>
        <a href="contact.html">Learn More</a>

      </div>
    </div>
  </div>
</div>

I utilized offset-sm-6 col-sm-6 in this snippet, but you can opt for offset-lg-6 col-lg-6 for larger screens in your project.

Answer №3

There are 2 ways to justify content at the end:

The first method is to use CSS with text-align:right;, while the second method involves using

display:flex; justify-content:end;

div{display:flex; justify-content:end;}

<div>hello</div>

Answer №4

In my opinion, it would be beneficial to have a designated row

<div class="row">
   <div class="d-flex justify-content-end">
      <div class="col-12">
        -------
      </div>
   </div>
</div>

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

Looking for assistance with arranging stacked column links into a horizontal row

I have a button and a link aligned in a column using flexbox. I am trying to adjust the layout so that both the link and the button are displayed on a single row when the max-width is set to 800px. Despite my efforts, I have been unable to find a solution ...

Unexpected element layout issues

Attempting to create a basic website that utilizes the flickr api, retrieves photos and details, and displays them using bootstrap. However, there seems to be an issue that I am unsure how to resolve. Currently, my code is functioning like so: https://i.s ...

What is the best way to create a close button using JavaScript?

I just started learning JavaScript and I want to figure out how to make the close button close the div .popup1 in the following code: https://jsfiddle.net/74hmx0vb/1 <div class='popup1' id="popup1"> <div class="containe ...

Exploring ways to manipulate checkboxes using jQuery for enhanced form validation

I am working on a custom validation for four fields, with one required to be filled in. However, I am facing an issue where the validation process is interfering with the functionality of my checkboxes. Once the jQuery click function runs, the checkboxes a ...

Personalizing Mat-Select Dimension - Angular 11

As a newcomer to Angular/Angular Material, I'm unsure if I need to write this code myself or if it's already predefined in a certain manner. The issue I'm experiencing is with the dropdown of the mat-select. The panel that appears when you c ...

One convenient script to easily toggle fading effects

I've successfully implemented a slide toggle functionality that hides all toggle elements when clicking outside the buttons. However, I'm facing an issue where I need to create a separate script for each button to display and hide the tooltip/con ...

What is the reason behind the improved performance I experience in Chrome with the Developer Console open?

Currently, I am developing a small canvas game completely from scratch using pure JavaScript. This game utilizes a 2D lighting algorithm that is akin to the one found here. It features only one light source and 25 polygons, resulting in approximately 30,0 ...

Vue.js app does not have the capability to display JSON data as a table

I successfully fetched JSON data in my vue app from the endpoint '/v1/api/sse?raceId=1', but I'm struggling to convert this JSON into a table format. The JSON is displaying correctly, but I'm unsure how to structure it into a table. He ...

Issue with Bootstrap 4 validation allowing submission of invalid forms despite errors

I have a module that includes an Ajax form to add a user to a group based on their email (if the email exists in the database). The back-end is functioning properly and processes the data, while the front-end receives the response. However, I am experienc ...

How to apply unique styles to multiple elements with the same class using jQuery?

How can I add different classes to multiple div elements with the same class based on their content? <div class = "flag"> Yes </div> <div class = "flag"> No </div> <div class = "flag"> Yes </div> <div class = "flag"& ...

Display a list with collapsed columns on an accordion format for a more compact view on smaller screens

My Bootstrap table setup looks like this: <table class="table table-striped"> <thead> <tr> <th>Date</th> <th>Name</th> <th>LastName</th> <th>Color</th> <th>Car</th> ...

Hover over a row in one table to modify the appearance of another row in a different table

Is there a way to change the appearance of rows in one table when hovering over rows in another table that are related? You can find a JSFiddle link illustrating what I am trying to achieve. Here is an example of the code: table#table1 #el1:hover + ta ...

Using inline style instead of relying on the quill editor's built-in classes, as classes may not be accessible in order to render HTML effectively

I have integrated the ngx-quill editor into my Angular project as the rich text editor. I plan to save the generated HTML in a database and display it on various browsers using innerHTML. Since the styling is done through a class attribute that references ...

What is the best way to line up a checkbox and its labels alongside a dropdown menu?

My index.html file has a header like this: https://i.sstatic.net/s0hAt.png I'm trying to align the checkbox and its label with the dropdown menu "In ordine". I'm using only bootstrap (no custom classes) and my current page layout is as follows. ...

Can a relative link with parameters but no path be used?

Can I omit the path from an href tag and begin with a question mark instead? For instance, if my website is https://example.com/mycgi, would it be acceptable to have a link like this: <a href="?foo=bar">bar</a>? I tested this on Fir ...

What is the best way to retrieve multiple model values from a single selection in AngularJS?

I recently started learning AngularJS and have a basic question to ask. I have a select box that allows users to choose a country from a list of countries. Currently, when a country is selected, only the country code is stored in the model. However, I woul ...

PayPal's fast checkout page experiencing a billing problem

I'm experiencing a problem with my paypal express checkout where it won't allow guest-checkout without logging into paypal, despite having the necessary form fields: <input type="hidden" name="SOLUTIONTYPE" value="Sole" /> ...

Reduce the page zoom to 75% without changing the page layout

I am looking to implement a forced zoom out feature on a webpage, reducing the overall size to 75%. Unfortunately, I am unable to disclose the specific code as it belongs to the company I work for. Despite researching various methods online, including solu ...

I am interested in setting up a flickr gallery where clicking on an image will display a pop-up showing the image along with its relevant tags, title, and photo ID

Page´s photo Hello there, I am currently working on creating a Flickr API using JavaScript and HTML. My goal is to search for photos and display them in an HTML page, but I'm struggling with implementing a pop-up feature that includes the photo' ...

Display modal after drop-down selection, triggered by API response

Currently, I am working on integrating an API to enable users to make payments through a modal. Users should be able to enter an amount and select a payment frequency. I have successfully extracted various payment frequencies from the API response and pop ...