Tips for positioning large text next to an image

When creating a product detail page in HTML, I encountered an issue where adding large text to one div caused the entire page layout to shift. Does anyone know why this is happening? Could it be due to the size of the div not being defined? See the issue here

[Initial state before adding large text]

html {
  position: relative;
  min-height: 100%;
  min-width: 100%;
}

body {
  margin-bottom: 60px;
  
}
a {
    color: inherit;
    text-decoration: none !important;
}
.small-paragraph2, .small-paragraph1{
    margin: 0;
}
.container {
    min-width: 90%;
    margin: auto;
    padding-left: 5px;
    padding-right: 5px;
    margin-top: 25px;
   
  
}
.product-image{
    width:400px;
    display:block;
    height: 400px;
}


.details {
    display:inline-block;
    margin:0; 
    vertical-align:top;
    
}

 .intro .text{
     line-height: 0.8;
 }
    <div class="container">
          
            <div style="display:inline-block;" >
                    <img class="product-image" src="/images/ruach-1.png" style="display:inline-block;">
                </div>
                <div class="details">
                 
                    <div class="intro">
                    <h3 class="text"><strong>Ruach 5781(AUDIO)</strong></h3>
                    <h4 class="text">New Jewish Tune</h4>
                    </div>

                    <h5>By <a asp-action="index" asp-controller="home">Various Artist</a>  Produced by
                      <a asp-action="index" asp-controller="home"> Joel English</a></h5>
                    <h6>Item: 955016DA</h6>
                    <button class="pro-button"><strong>Print Songbook with Audio</strong><br />$19.95</button>
                    <button class="pro-button"><strong>PDF Songbook</strong><br />$19.95</button>
                    <button class="pro-button"><strong>Digital Album</strong><br />$19.95</button>
                    <span class="minus wrapper" style="color:grey;">-</span>
                    <span class="num wrapper" style="color:grey;">1</span>
                    <span class="plus wrapper" style="color:grey;">+</span>
                     <a asp-action="index" asp-controller="home" class="myButton" style="border: 0px;"><i class="fa-solid fa-bag-shopping"></i>Add to Cart</a>
                     <a asp-action="" asp-controller="" style="display:inline-block;" class="addtolist">Add to List <i class="fa-solid fa-caret-down"></i></a>
                    <p class="small-paragraph1"><strong>10% off </strong>distracted by the readable content ofs layout.</p>
                    <p class="small-paragraph2">is simply dummy text of the printing and typesetting . Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
                        when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
                        survived not only five centuries, but also the leap into electronic typesetting, remaining essentially 
                        unchanged.is simply dummy text of the printing and typesetting . Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
                        when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has 
                        survived not only five centuries, but also the leap into electronic typesetting, remaining essentially 
                        unchanged.
                    </p>
                
                 </div>

]View image after resizing issue

Answer №1

To enhance the layout, introduce the style rule display: flex; within the .container class.

html {
  position: relative;
  min-height: 100%;
  min-width: 100%;
}

body {
  margin-bottom: 60px;
}

a {
  color: inherit;
  text-decoration: none !important;
}

.small-paragraph2,
.small-paragraph1 {
  margin: 0;
}

.container {
  margin: auto;
  margin-top: 25px;
  display: flex;
  gap: 10px;
}

.product-image {
  width: 400px;
  display: block;
  height: 400px;
}

.details {
  display: inline-block;
  margin: 0;
  vertical-align: top;
}

.intro .text {
  line-height: 0.8;
}
<div class="container">
  <div style="display:inline-block;">
    <img class="product-image" src="https://dummyimage.com/600x400/000/fff" style="display:inline-block;">
  </div>
  <div class="details">
    <div class="intro">
      <h3 class="text"><strong>Ruach 5781(AUDIO)</strong></h3>
      <h4 class="text">New Jewish Tune</h4>
    </div>
    <h5>By <a asp-action="index" asp-controller="home">Various Artist</a> Produced by
      <a asp-action="index" asp-controller="home"> Joel English</a></h5>
    <h6>Item: 955016DA</h6>
    <button class="pro-button"><strong>Print Songbook with Audio</strong><br />$19.95</button>
    <button class="pro-button"><strong>PDF Songbook</strong><br />$19.95</button>
    <button class="pro-button"><strong>Digital Album</strong><br />$19.95</button>
    <span class="minus wrapper" style="color:grey;">-</span>
    <span class="num wrapper" style="color:grey;">1</span>
    <span class="plus wrapper" style="color:grey;">+</span>
    <a asp-action="index" asp-controller="home" class="myButton" style="border: 0px;"><i class="fa-solid fa-bag-shopping"></i>Add to Cart</a>
    <a asp-action="" asp-controller="" style="display:inline-block;" class="addtolist">Add to List <i class="fa-solid fa-caret-down"></i></a>
    <p class="small-paragraph1"><strong>10% off </strong>distracted by the readable content ofs layout.</p>
    <strong>Description: </strong>
    <p class="small-paragraph2">is simply dummy text of the printing and typesetting . Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only
      five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.is simply dummy text of the printing and typesetting . Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
      took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
    </p>
  </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

Intermittent Cloudfront Content Delivery Network (CDN) disruptions (monitoring) - Implementing CDN Fail

Over the past two months, I've been dealing with sporadic issues involving Amazon Cloudfront. These failures occur 2-3 times a week, where the page will load from my web server but assets from the CDN linger in pending status for minutes at a time. It ...

What is the best way to configure dependencies for a production deployment when utilizing Babel within the build script?

From what I understand, Babel is typically used for compiling code, which is why it usually resides in devDependencies. However, if I incorporate the Babel command into my build script and want to run npm install --only=prod before running npm run build d ...

Changing properties of JavaScript arrays

Currently using Express and dealing with an array of objects that I need to adjust the created property for better presentation, utilizing the dateFormat package. The array originates from a mongo query and is stored in a variable called stories. A sample ...

Rendering in Three JS involves efficiently utilizing one buffer to display the output within itself

I have been struggling with a particular issue and I really need some assistance: In my three js context, I have created a custom material and rendered it into a texture. ` /* Rendering in texture */ fbo_renderer_scene = new THREE.Scene(); fbo_r ...

Utilizing Nuxt3's auto-import feature alongside Eslint

I'm having trouble finding an eslint setup that is compatible with Nuxt3's auto-import feature to prevent no-undef errors. I have tried various packages like @antfu/eslint-config, plugin:nuxt/recommended, @nuxt/eslint-config, @nuxtjs/eslint-confi ...

How to pass data from a child component to a parent component in React applications

In my search component, I need to pass a variable called "apiUrl" to the parent component. While I have successfully handled events for other parts of the code, I am unsure how to manage this specific variable transfer. The goal is to send the dynamically ...

What's the best way to fill checkboxes in EJS when editing a route?

As a beginner, I am working on my first project - a simple content/property listings app. I have created a form to collect user data and display it on a show form. The form includes sections for checkboxes and radio buttons, with the values being stored i ...

Searching for elements in Selenium using Python without a specified name

Looking for some assistance here. I'm trying to use Selenium to access a search field, but it doesn't have a name or ID in the html code. How can I locate and interact with this search field using Selenium? View the HTML code snippet for the sea ...

Utilize the ionicPlatform.ready() method for implementing a service factory

Within my app.js file, I have the following method: .run(function($ionicPlatform) { $ionicPlatform.ready(function() { gvi.Notifications.registerForPush(MessagesService.onNotificationResponse); }); }) Additionally, I have a factory ...

The conditional ng-class styling will be applied to each and every div on the page

For a patient, I have a modal displaying a list of card numbers. If the card is set as the default card, it should have a grey background, based on a true value for the object. <td ng-repeat="obj in paymentAndShipping"> <div ng-click= ...

Is there a way to ensure my program waits for Firebase's data retrieval before running a specific function?

As a newcomer to Next.js and Firebase, I embarked on creating a login system with roles recently. Leveraging Firebase Authentication, I stored account roles in Firestore and linked the authentication account with Firestore data by utilizing the UID as the ...

QWebEngineView - handling content larger than 2 megabytes

While working with PyQt5's QWebEngineView, I encountered a 2 MB size limitation when using the .setHTML and .setContent methods. After researching potential solutions, I came across two approaches: One option is to use SimpleHTTPServer to serve the f ...

Issues with implementing the Skeleton feature in the Alert module

Having an issue with a Skeleton component not taking full width inside an Alert component. It seems to be occupying less space than expected. https://i.stack.imgur.com/cMLEy.png Here is the relevant code snippet: <Alert icon={<NotificationsIcon s ...

In React, ensure a component's state is preserved when the browser history changes

I recently developed a React application that features a classic layout with a left-side menu, title, footer, and main content section. The side menu includes navigation links structured using components such as <List>, <ListItem>, etc. from th ...

Error: Unexpected end of argument list in file c:/.../list.ejs during ejs compilation

Hello, I am a beginner in programming and I have been working hard to learn. Unfortunately, I encountered a SyntaxError: missing) after argument list in c://.../list.ejs while compiling ejs error and I am struggling to find the solution. I am reaching out ...

What could be causing my Angular Ngrx app's state not to render properly on the application?

Is there a way to automatically render the state when the app loads without having to click a button? I am currently facing an issue where the state is empty until I manually trigger the click function by pressing a button. I have tried using this.store.se ...

Creating a Full Screen Image with HTML and CSS

On my current web project, I am aiming for an immediate impact with a full-screen image that transitions to reveal text and information when the user starts scrolling. The challenge lies in ensuring this effect is consistent across various screen resolutio ...

How do I use PHP to dynamically generate lists in HTML with the <li> tag?

Is there a way to repeat the <li> element in this code snippet? I have been attempting to create a loop for the "<li>" block, but it keeps showing me an error. <?php $html .= " <li> <a href=''> <span& ...

ERROR: No compatible version of jQuery Foundation could be located

Encountering issues while installing Foundation due to conflicts with Jquery. λ bower install foundation bower foundation#x cached https://github.com/zurb/bower-foundation.git#5.5.1 bower foundation#x validate 5.5.1 against https: ...

I strive to establish a strong link between React and Firebase

I am facing an issue with Firebase and React. The problem arises after clicking on my add-data button to insert data into the database. Below is the error message I receive in the console: Reference_impl.ts:482 Uncaught TypeError: db._checkNotDeleted ...