Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

give me html div imply in desktop an image on the left side and text on the right text…

  1. User

    give me html div imply in desktop an image on the left side and text on the right text and on the mobile screen the image on the top and text on the below the image:

  2. Assistant

    To achieve this layout, you can use CSS media queries to target different screen sizes. Here's an example of how you can implement it using HTML and CSS:

    <div class="container">
      <div class="image">
        <img src="your-image-url.jpg" alt="Image">
      </div>
      <div class="text">
        <p>Your text goes here</p>
      </div>
    </div>
    
    .container {
      display: flex;
    }
    
    @media (min-width: 768px) {
      .image {
        order: 1;
        flex-basis: 50%;
        padding-right: 20px;
      }
      
      .text {
        order: 2;
        flex-basis: 50%;
        padding-left: 20px;
      }
    }
    
    @media (max-width: 767px) {
      .container {
        flex-direction: column;
      }
      
      .image,
      .text {
        padding: 0;
      }
      
      .text {
        margin-top: 20px;
      }
    }
    

    In this example, on desktop screens (min-width: 768px), the image div will be on the left side with 50% width, and the text div will be on the right side with 50% width. On mobile screens (max-width: 767px), the image div will appear on the top and the text div will appear below the image. The media queries are used to apply different CSS styles based on the screen size.

  3. User

    Edit the following based on HTML div in which the IMAGE ON THE LEFT side of the text in windows and the image on the top of text in the mobile screen: Szenario 1

  4. Assistant

    To achieve the desired layout in both desktop and mobile screens, you can modify the existing HTML structure and add CSS styles accordingly. Here's the updated code:

    <div class="container">
      <div class="image">
        <img src="your-image-url.jpg" alt="Image">
      </div>
      <div class="text">
        <p style="margin-right: 0; margin-left: 0;">
          <span style="font-size: 11pt; font-family: Calibri, sans-serif;">
            <b>
              <span style="font-size: 12.0pt; background: whitesmoke; color: #2e74b5;">
                Szenario 1
              </span>
            </b>
          </span>
        </p>
        <p>This is your text content.</p>
      </div>
    </div>
    
    .container {
      display: flex;
    }
    
    .image {
      order: 1;
      padding-right: 20px;
    }
    
    .text {
      order: 2;
      padding-left: 20px;
    }
    
    @media (max-width: 767px) {
      .container {
        flex-direction: column;
      }
      
      .image {
        padding: 0;
      }
    }
    

    In this updated code, the image is placed on the left side of the text in desktop screens. On mobile screens, the image will appear on the top of the text. The media query is used to modify the layout for screens with a maximum width of 767px. The CSS styles are adjusted to achieve the desired result.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.