Develop a responsive component on the right side

I am encountering an issue with creating a responsive div that matches the height of the image on the left side. I want to include text in this div, however, when I do so, the paragraph expands in height along with the div element when I attempt to change the window resolution. View codepen

HTML:

#left-side {
  width: 50%;
  height: 60em;
  background-color: black;
  float: left;
  text-align: center;
  display: inline-block;
}

#left-side>div>img {
  margin-top: 15%;
  border: solid #A98646 2px;
  border-bottom: none;
  width: 50%;
  height: 25%;
}

#right-side {
  width: 50%;
  height: 60em;
  background-color: red;
  float: left;
  text-align: center;
  display: inline-block;
}

.description {
  margin-top: 15%;
  width: 50%;
  height: 72%;
  margin-left: 25%;
  background: green;
}
<section>
  <article id="left-side">
    <div class="image">
      <img src="img1.jpg">
    </div>
  </article>
  <article id="right-side">
    <div class="description">2</div>
  </article>
</section>

Answer №1

Have you ever considered using position:absolute; on the #right-side element for a unique layout?

Check out the CodePen example here

header{
    background-color: #282828;
    width: 100%;
    height: 35em;
}

header > h1{
    color: #A98646;
    font-family: 'Righteous';
    font-size: 4rem;
    text-align: center;
    padding-top: 6.75rem;
    
}

header .logo{
    width: 40px;
    margin-left: 2rem;
    margin-top: 2rem;
    opacity: 0.3;
}

header .logo:hover{
    opacity: 1;
    transition: 0.2s;
}

nav{
    float: right;
    margin-right: 2rem;
    margin-top: 0rem;
    text-align: center;
    cursor: pointer;
}

nav li{
    display: none;
    background-color: black;
}

nav>ul>img{
    width: 100px;
}

header > p{
    text-align: center;
    margin-top: 30px;
    color: white;
    font-family: 'Old Standard TT', serif;
}



#left-side{
    width: 50%;
    height: 60em;
    background-color: black;
    float: left;
    text-align: center;
    display: inline-block;
}
.image {
  height: 100%;
  position: relative;
}

#left-side>div>img{
    margin-top: 15%;
    border: solid #A98646 2px;
    border-bottom: none;
    width: 50%;
    height: 75%;
}


#right-side{
    width: 50%;
    height: 100%;
    background-color: red;
    text-align: center;
    display: inline-block;
    position: absolute;
}

.description{
    width: 50%;
    height: 75%;
    margin: 15% auto;
    background: green;

}


section { 
    height: 100%;
    display: inline-block;
    position: relative;
    width: 100%;
}
<section>
  <article id="left-side">
    <div class="image">
      <img src="img1.jpg">
    </div>
  </article>
  <article id="right-side">
    <div class="description">2</div>
  </article>
</section>

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

Display the entire width of the element without obstructing any subsequent elements

I have a main container with an inner container. I want the inner container to span the full width of the screen. The challenge is that I can't simply set the inner container's width to 100vw because it is nested within the main container, which ...

Change the color of the menu icon based on the specified HTML class or attribute

I'm trying to create a fixed menu that changes color depending on the background of different sections. Currently, I am using a data-color attribute but I am struggling with removing and adding the class to #open-button. Adding the class works fine, ...

Retrieving Form Validation Error Value in AngularJS

Incorporating AngularJS 1.2 RC2 and utilizing Bootstrap for CSS, I have constructed a straightforward form as shown below: <form class="form-horizontal" name="form" novalidate> <label class="col-lg-2 control-label" for="name">Name</labe ...

What could be causing the absence of the box within the div element?

I am still learning the ropes of javascript, CSS, HTML and programming in general. Despite being a beginner, I have managed to grasp the basics of simple HTML and CSS. I had successfully created a nested div structure before, but suddenly the inner div is ...

File uploading feature in Bootstrap (without the need for Javascript)

While I've seen this question posted in a similar style before, one critical point (in my opinion) hasn't been addressed - is there a way to achieve this without using JavaScript? On mobile devices, overscripted sites can sometimes have non-worki ...

Creating a Click Counter with jQuery 2.0.1/2.0.2: A Step-by-Step Guide

Currently in the process of creating a fundraising webpage for charity, I have chosen to display an animated rabbit making its way Around The World. My progress so far includes a non-looping gif that plays on click, with a limitation on how often it can b ...

ways to set a background color for a textarea element using bootstrap

How can I add a background color to my text area field in Bootstrap? <div class="form-group"> <div class="col-xs-12"> <textarea class="form-control" id="exampleTextarea" rows="6" placeholder="Message" style="background-color: #f ...

The functionality of Bootstrap styles is not compatible with Code Igniter

I tried placing the bootstrap folder in the root folder and loading the styles in the header section of view files like this. Unfortunately, it didn't work as expected. Can someone please assist me in solving this issue? <link href="<?php e ...

sticky bootstrap datepicker anchored to the top of the screen

Currently, I am working on a form that includes a date picker using the bootstrap datepicker In this setup, I have hidden the main bootstrap field and added three custom fields. When any of these fields are clicked, the calendar should open next to them. ...

Modifying the HTML file won't be immediately visible in browsers

I encountered a frustrating issue while working on my website. Despite making changes to the code, the browsers are not reflecting the updates. This problem is occurring in Internet Explorer, Google Chrome, and Firefox. Initially, I had a div with a link ...

What is the process for incorporating a side group input with Bootstrap?

description of image here I am looking to add 4 small input boxes next to the third input box. Please refer to the image I have attached for reference. In the image, I have included 4 boxes. I am specifically looking for a similar layout. ...

Is it possible to conceal glyphicons by employing the attribute hidden="hidden"?

Is it possible to conceal a glyphicon icon in this manner? <i class="glyphicon glyphicon-remove-circle" title="Please add a suitable value" id="author" hidden="hidden"></i> <p>Author</p> ...

Using AJAX to dynamically edit and update PHP data

The information displayed on my index.php page is fetched from a database using the mysqli_fetch_array function. The data is presented in a table format with fields like Name, Age, Email, and Update. An edit button allows users to modify the data. Here is ...

Using Javascript to Treat an HTML Document as a String

Check out the complete project on GitHub: https://github.com/sosophia10/TimeCapsule (refer to js/experience.js) I'm utilizing JQuery to develop "applications" for my website. I'm encountering a problem where I can't locate the correct synta ...

Discover how to effortlessly unveil JSON data by clicking on data retrieved from an API

After successfully parsing data from a Tumblr API, I encountered an issue when introducing tags within the body description, which includes images and hyperlinks. The main task at hand is to create a list of blog titles where the corresponding blog descri ...

Is left padding appearing mysteriously (supernatural CSS phenomenon)?

While using the Firebug inspector tool, if you hover over #jimgMenu ul, you may notice that it has left padding without any corresponding CSS rule: Where is this mysterious left padding coming from? Why is the origin not visible? EDIT: If you navigate t ...

Several problems with CSS regarding DIV height set to 100% and the content inside

I'm facing a bit of a puzzle here. I have a div that spans the full height of the browser, with a background set to 100% size and image content contained in two inline divs that are vertically aligned in the middle. In one of these divs, the image is ...

Transmitting the identification number of a post with the help of J

I am currently working on a while loop in PHP that fetches associated results from a query and displays them within a class identified by the user who created the post. My goal is to send the id of the class to PHP, similar to how I am sending the num vari ...

Updating HTML Pages with Dynamic Content

Dealing with a massive project consisting of 50,000 pages (20,000 aspx forms, 10,000 asp forms, and 10,000 html pages) can be overwhelming. With only 2 days to complete the task of adding content after the body tag on all pages, I am seeking advice on ho ...

Empower the parent container to wrap around its child elements using Flexbox

I am trying to make the flexbox parent item adjust its width based on the children, but currently it is stretching out to full width and leaving empty space on the right side. Here is the CSS code I have tried: .flexParent { display:flex; background:# ...