image in responsive css design

Image 1 (Current Layout)

Image 2 (Desired Layout)

I am trying to achieve a responsive layout similar to the second image. However, I seem to be stuck with the layout from the first image.

Here is the CSS code I'm currently using:

@media (max-width: 960px) {
    .nav {
        width: 100%;
        height: 2em;
    }

    #nav-icon {
        width: 100px;
        height: 50px;
    }

    .container {
        width: 100%;
        margin: 0;
        padding: 3%;
    }

    .container div {
        display: inline;
        width: 45%;
        margin: 0;
        padding: 1%;
    }

    .container div img {
        width: 100%;
    }
}

If anyone could offer assistance on how to achieve the desired layout, it would be greatly appreciated! Thank you!

Answer №1

To achieve a responsive design, I recommend utilizing Bootstrap's grid layout found at Bootstrap. You can easily create a grid by using the classes

col-xs-6 col-sm-6 col-md-6 col-lg-6
. In the first column, insert an image with full height. Then in the second column, add two images vertically aligned using CSS properties.

Answer №2

Utilize the Bootstrap grid system to create responsive images effortlessly.

Below is the code for your image. If there are any alignment issues based on screen width, you can address them using the @media rule.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
 <div class="row">
    <div class="col-xs-12" style="display:absolute;">
       <div class="col-xs-6">
           <img class="img-responsive" src="http://i.imgur.com/neOKPvD.png">
       </div>
       <div class="col-xs-6">
           <div class="col-xs-12">
           <img class="img-responsive" src="http://i.imgur.com/fYeBJ8S.png">
            <h4>Add text here</h4>
            <p>description</p>
           </div>
           <div class="col-xs-12">
           <img class="img-responsive" src="http://i.imgur.com/Y6wIPnl.png">
           </div>
       </div>
    </div> 
 </div>
</div>

</body>
</html>

Answer №3

<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<body>

<h1>Displaying in Full Page </h1>

<div class="w3-row w3-col s9 ">

<div class="w3-container w3-half ">
  <img src="http://i.imgur.com/OKzIMYS.png">
</div>

<div class="w3-container w3-rest ">
  <img src="http://i.imgur.com/HcNSP13.png">  
<p class="w3-large" <strong> Animated Vector</strong> </p>
<p class="w3-text-grey w3-opacity w3-large"><i>Art, Design, Web </i></p>
<br>
<img src="http://i.imgur.com/DiqFrE1.png">
</div>
</div>

</body>
</html>

Answer №4

Gratitude to everyone~~~ I believe I have discovered how to accomplish that task. I utilized the css3 property: column. (css3 column property) It seems quite similar to the bootstrap grid layout. This is my first time asking a question here, and I received numerous helpful responses in such a brief period. You all are amazing! Thank you once more!

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

What is the best way to randomly display an image from a JavaScript array within an HTML document?

I currently have this code in my HTML and JavaScript files, but I am having trouble with displaying images without using a URL in the JavaScript file. The images are located in my project folder. However, when I open the HTML file, the images do not appear ...

Change the CSS property to override the text-overflow with ellipsis

In my specific scenario, I need to override the default ellipsis behavior that adds '...' to text when using 'text-overflow: ellipsis', and instead use two stars **. Is there a way to achieve this using only Pure CSS? It is important t ...

Struggling with choosing a specific subcategory from the menu

Having trouble navigating through the submenus? Here's a solution! *,body{ margin: 0; padding: 0; box-sizing: border-box; list-style-type: none; font- ...

Enhancing Page Content Dynamism: Making Elements Static

I have a div element that I want to align on the right side of the screen, but the problem is that it doesn't adjust its position as the content dynamically expands and exceeds the width of the page. Despite conducting extensive research, I haven&apos ...

Styling the background of the endAdornment in a material-ui textfield using React

I tried following the instructions from this source: Unfortunately, the example code provided doesn't seem to be functioning properly now. Is there a way to achieve the same result without having that right margin so that it aligns better with the r ...

Struggling to align the Bootstrap list-group container in the middle

Good day to you! I'm currently working on a sidebar layout using Bootstrap's list-group and I need to set a specific width to ensure it aligns properly with the other elements above and below it. However, when I try setting the width to 300px, t ...

A guide to using the up and down keys to switch focus between div elements in a react component with TypeScript and CSS

I am currently working with a scenario where data is being displayed within different div elements, and I wish to enable the selection/focus of a specific div when users use the up/down arrow keys. While trying to achieve this functionality by using refs ...

Integrate a new Webview Window into an existing iOS App to display locally stored HTML content

Integrate a WebView Window into an existing iOS application to display locally stored HTML content. I have already completed the feed RSS feature in my app, but now there is a requirement for a section that can be easily updated... ...

NodeJS is facing a severe challenge in properly rendering HTML and its accompanying CSS code, causing a major

Once upon a time, I built a beautiful website while practicing HTML, CSS, and JS. It had multiple web pages and used Express for the backend. Unfortunately, I lost all the files associated with it and took a break from web programming for some time. Now, w ...

How can you implement a transform transition toggle when a user clicks on an element

Check out this CodePen example for a cool overlay animation: https://codepen.io/pen/MoWLrZ Experience the unique animation of two overlays as you click for the first time. However, on the second click, watch as both overlays seamlessly return to their ori ...

single-use date availability checker

I'm currently facing an issue with my code. It seems to be functioning correctly, but only for the first iteration. Let me explain further. If I select a date and time that is already in the database, it correctly displays "date unavailable". Likewis ...

Hide CSS3 webkit-scrollbar automatically when it's not in use

I need help with customizing scrollbars. How can I hide the scrollbar when it is not needed due to short content? Below is the code snippet I have been working on: .myscroll::-webkit-scrollbar { width: 15px; } .myscroll::-webkit-scrollbar-track ...

Is it possible to eliminate the input border within React-Bootstrap?

Struggling to remove the input borders of the Form.Control component in React-Bootstrap. Despite searching for answers, nothing has been able to solve this issue. I've attempted redefining the .css classes "input" and "form-control", trying to set th ...

DIV size issue resolved

Content within a div is surpassing the set fixed size determined by CSS. <style> #fixeddiv { position: fixed; margin: auto; max-height: 300px; max-width: 700px; } </style> <div id="fixeddiv"> <div id="M77 ...

"Maximizing the power of Jquery's .each function. What

In my jQuery code, I have the following: function lshow() { var delayt = 500; var showtime = 5000; var ArrayOfElements = ['.slogan1','.whatwedo','.ekon','.ene', '.ekol', '.sm&a ...

Tips for directing the scroll according to the current selection class

I am attempting to focus the scroll based on the selected class when clicking on the previous and next buttons. How can I achieve this functionality? Please review my code on https://jsfiddle.net/kannankds/bcszkqLu/ <ul class="kds"> <li>tile ...

Issue with displaying YouTube videos in HTML causing them to be downloaded instead of playing

I'm currently facing an issue with loading a video on my HTML page using the following code: <video v-for="(data, key) in projectData.videos" :key="key" width="320" height="240" controls> <source :src="data.url"> </video> One ...

Using JQuery to enable the movement of divs on a screen through clicking and dragging, without the use of

Recently, I've been experimenting with a small project involving draggable divs. However, the code I've written doesn't seem to be functioning properly, causing JQuery to become unresponsive. Is there an alternative method that is simple an ...

Aligning the icon within the div and adding a gap between each div

I'm fairly new to web design, specifically dealing with html and css, and I'm attempting to create something similar to the design in the following image: My struggle lies in centering the fa-envelope-o icon both horizontally and vertically. I&a ...

CSS media queries to exclude a property for mobile devices

I have a CSS class with the width property set to calc(100% - 17px). However, I want to ignore this property completely for devices with specific resolutions. I've tried using media queries and values like initial, inherit, and unset for the width pro ...