What is the best way to ensure my images are responsive to the varying device sizes when displayed on this website?

In my endeavor to design a 2-column layout using Bootstrap, I aim for each row to consist of two columns:

One column will contain text, while the other will display images that complement the textual content.

Below is the Bootstrap code snippet for the navigation bar:

This is the navigation bar.

<div class = "navbar navbar-default navbar-static-top">

   <div class = "container ">

    <a href = "# " class  = "navbar-brand">levi</a>
          <button class = "navbar-toggle" data-toggle = "collapse" data-target = ".navbar-collapse"
           name = "button" >
          <span class = "navbar-toggle-Menu">Menu</span>
          </button>
    <div class = "collapse navbar-collapse ">

           <ul class = "nav navbar-nav navbar-right ">

                    <li><a href="#"> product</a></li>
                    <li><a href="#"> price</a></li>
                      <li><a href = "#">Support</a></li>
                    <li><a href = "#">Sign In</a></li>
           </ul>

    </div>

   </div>

  </div>

The following code demonstrates a 2-column layout setup for each row:

<div class = "container">

        <div class = "row">

          <div class = "col-sm-6 col-md-6 col-lg-8">
                  <h3><b>Connect Soft documents</b></h3>
                  <p class = "lead">Allow documents that feed into each other to provide a consistent, untainted view of the
                financial, operational and social behavior of the institution.</p>
          </div>

          <div class = "col-sm-3">
  Image

          </div>

        </div>



        <div class = "row">

          <div class = "col-sm-5">
  <h3><b>Improve decision models</b></h3>
  <p class = "lead">Use statistical modeling to identify patterns and anomalies in the data that can help in
  making better decisions.</p>
          </div>
          <div class = "col-sm-6">
           <img src = "Statistics.png" alt = "Statistics" width = "350px" height = "270px"  class = "pull-right img-responsive imG">
          </div>

        </div>

        <div class = "row">

          <div class = "col-sm-6">
              <h3><b>Search. Get what is important to You!</b></h3>
              <p class = "lead">All notifications and documents are indexed and
              archived so that you can find what is needed at all times.</p>
          </div>
          <div class = "col-sm-6">

          </div>

        </div>


        <div class = "row">

          <div class = "col-sm-4">
            <h3>Collaborate with other apps!</h3>
              <p class = "lead" >Connect to the tools you need to prevent wasting time using so many apps </p>
          <div class = "col-sm-8">
<img src = "Integrate.jpg" alt = "Integrate" width = "300" height = "300" >
          </div>

        </div>

</div>
<footer>

<div class = "">
<ul>
  <li>Security</li>
</ul>
</div>
</footer>

The desired functionality specifies that on desktop screens, text aligns left and images align right. On screens smaller than 768px, text should be above the image, and the image centered.

For instance:

Desktop: Text | Image

Mobile:

Text


Image

Please refer to my jsfiddle Bootstrap website, which should exhibit the same responsive design as Slack's product page:

Slack's product page

Answer №1

Simply apply this CSS to make images responsive:

.imG{
    float: none !important;
    margin: auto;
    text-align: center;
}

Check out the updated JS Fiddle here

Answer №2

Below is the proposed solution:

<div class="row">
  <div class="col-md-6 col-sm-12">
    <h3>Collaborate with other apps!</h3>
    <p class="lead">Connect to the tools you need to prevent wasting time using so many apps </p>
  </div>
  <div class="col-md-6 col-sm-12 text-center-sm">
    <img src="Integrate.jpg" alt="Integrate" width="300" height="300">
  </div>
</div>

I have also included a conditional text-align class in the CSS stylesheet.

.text-center-xs {
    text-align: center;
}

/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .text-center-sm {
        text-align: center;
    }
}

/* Medium devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .text-center-md {
        text-align: center;
    }
}

/* Large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .text-justify-lg {
        text-align: center;
    }
}

You can access the complete jsfiddle here

Ensure proper tabulation in your HTML code for improved readability.

Best regards!

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

Styling for older versions of Internet Explorer (IE10 and earlier)

Could it be true that IE 10, 9, and others no longer support conditional statements? Is it also accurate to say that JQuery does not support the browser object above version 1.9? I am facing an issue with CSS rendering differently in Chrome and IE. A Goog ...

A comprehensive guide on personalizing Bootstrap 4 tooltips to suit your specific needs

I would like to customize the tooltip in Bootstrap 4 based on the screenshot provided below: https://i.stack.imgur.com/wg4Wu.jpg <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta chars ...

Issue with the Z-Index property not functioning as expected on unordered lists within a dropdown menu

I have a dropdown menu that opens to the left, but it is displaying underneath the content. I attempted adjusting the z-index of the content to 1 and the dropdown to 2, however, this did not resolve the issue. Here is a sample in jsFiddle: https://jsfiddl ...

Issues arising with transferring information between components

My webpage had a header with a search engine input, a list of posts, and pagination all on one page. I made the decision to separate the header into its own component in a different Vue file. However, after making this change, searching for posts by their ...

Reviewing user input for any inappropriate characters using jQuery's functionality

When a username is inputted into the input box, I want to make sure that only valid characters are accepted. The following code shows what I have so far; but what should I replace "SOMETHING" with in the regular expression? var numbers = new RegExp( ...

Unveiling the search bar as it expands horizontally from the center, causing the submit button to slide to adjust

Wishes and Aspirations My goal is to design an .input-group with one input[type=text] and one button[type=button]. Initially, the text box should be hidden, leaving only the button visible at the center of the page. Upon activation, the text box should ...

I have come to realize that in my creation, my method does not function flawlessly as

I'm currently experimenting with creating a simple code using vue.js and d3.js. The goal is to plot some charts within the code, so I am attempting to allocate space for the charts by defining a method('add_svg') and executing the method in ...

The value entered in the HTML input is not being recognized by PHP

I'm facing an issue with my project (index.php), which is a HTML webpage. I am trying to use the 'include' function to bring in the header and footer (header.php, footer.php). Additionally, I want the current date to automatically populate i ...

"Unexpected behavior: PHP+JS getElementById() function is returning an integer value instead of a

EDIT: Apologies for the PHP section not displaying correctly. I am attempting to extract a decimal value from PHP/HTML in JavaScript using getElementByID().value. However, despite the PHP value being decimal, it is represented as an integer in JavaScript ...

Transformation of visuals with alteration of status

I am attempting to change the image of a door from closed to open when the status changes in my home automation dashboard. I need help with this task. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&qu ...

How can I customize the appearance of the file input button in Angular Material?

Despite browsing numerous similar questions, I have yet to find a solution to my issue. My setup includes Angular 11, Angular Material 8, and a file input structured like this: <div class="form-group"> <input #myInput type="fil ...

Concealing Bootstrap 3 elements on a split-screen layout

I encountered a peculiar issue with Bootstrap 3. When I resize my browser width to half the screen, there is a slight 1px threshold where both "hidden-xs" and "hidden-sm" elements become visible simultaneously. Is there a way to fix this so that only one o ...

Increasing the size of a container without displacing the elements beneath it

There is an element on my webpage that, when hovered over, expands to reveal hidden text. The issue I'm facing is that this expansion causes the content below it to shift position. I attempted to use position:absolute, but it did not have the desired ...

Error encountered when trying to show a modal using a PHP script

I'm encountering an issue with the modal system on my website. Let me share some code snippets: MODALS ARE BUILT WITH W3.CSS LIBRARY modal.js (including debug statements) let modal = null; let title = null; let content = null; $(document).ready(() = ...

Discovering the art of line breaks

Imagine I have a random block of text displayed in a single line, like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Due to various reasons such as width settings or text-zoom, the text may display as two or more lines on the viewer&apos ...

Issue with Bootstrap margins and padding

While creating an application form from scratch with Bootstrap, I encountered a peculiar issue. The element with ID officeaddress is missing from the HTML page upon loading. I've experimented with the my class in Bootstrap and attempted to add line br ...

Is there a way to automatically launch a new tab upon arriving from another website?

I currently have a website that displays a table of elements, each with its own set of sub-elements. On another page, I can view the element along with multiple tabs for its corresponding sub-elements. The current setup is depicted as follows: <a clas ...

Trouble with Angular 7: Form field not displaying touched status

I am encountering an issue while trying to input data into a form, as it is not registering the touched status. Consequently, an error always occurs when attempting to send a message back to the user. In my TypeScript file, I am utilizing FormBuilder to c ...

Troubleshooting issues with Bootstrap Nav-pills functionality

I have encountered an issue with my navigation structure. I am using a main nav-menu and a secondary nav-menu within the same div. When I first enter the page, the "Profile" tab is correctly active by default. Then, when I click on "Test", it becomes activ ...

Stop text from being selected across all browsers in Firefox

My current CSS includes: *{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } If you visit http://jsfiddle.net/KyF5x/ and click be ...