What can be done to prevent a div from moving to the next line and instead make it fluid when the browser is resized?

Is there a way to prevent the purple div from moving to the next line? I want the text to remain flexible and not shift to the next line when the browser is resized. The goal is for the green and purple div to always stay aligned.

You can view my progress so far here: https://jsfiddle.net/Ljcu1hyw/

I apologize if this question seems silly, but I seem to be overlooking something here and would appreciate a second opinion.

Thank you for your assistance!

.marco-maggio {
  width: 100%;
  height: 100%;
  background: #f0f0ef;
  box-sizing: border-box;
  padding: 80px 0px 100px 0px;
}

.marco-maggio .profile-wrapper {
  background: #FFBFBF;
  height: 100%;
  width: 100%;
  max-width: 1130px;
  margin:0 auto;
}

.profile {
  height: 100%;
  width: 340px;
  background: #DFFFBF;
  padding: 0 20px;
  box-sizing: border-box;
  display: inline-block;
}

.description {
  height: 100%;
  width: 100%;
  max-width: 780px;
  background: #DFBFFF;
  display: inline-block;
  box-sizing: border-box;
  padding: 0 20px;
  Float: right;
}
.description h1 {font-family: 'Montserrat', sans-serif; font-size: 34px; font-style: normal; font-weight: 700;}
.description h2 {font-family: 'Playfair Display', serif; font-size: 20px; font-style: italic; margin-top: 5px;}
.description span {font-family: 'Source Sans Pro', sans-serif; font-size: 16px; display: inline-block; margin-top: 50px;}

.profilepic {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: #80BDFF;
}

.profile-span {
  font-size: 15px;
  font-family: 'Source Sans Pro', sans-serif;
  margin-top: 50px;
}

Answer №1

The reason for this issue is due to the width: 100% set for the .description class.

Here's an alternative solution:

.description {
    width: calc(100% - 340px); // Subtracting the 340px width of .profile from the total width of 100%
}

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

Creating triangular shapes that can be interacted with by hovering

I'm trying to create a diagonal triangle on the screen that changes color when hovered over. However, my current method only creates a 'hack triangle' which is actually just a rectangle and doesn't respond to the transparent section. I ...

What is the best way to change the date format from "yyyy-MM-dd" in a JavaScript file to "dd/MM/yyyy" and "MM/dd/yyyy" formats in an HTML file?

Is there a way to transform the date string "2020-08-02" from a JavaScript file into the formats "08/02/2020" and "02/08/2020" in an html file, without relying on the new Date() function in JavaScript? I would greatly appreciate any assistance with this t ...

Changing the position of an image can vary across different devices when using HTML5 Canvas

I am facing an issue with positioning a bomb image on a background city image in my project. The canvas width and height are set based on specific variables, which is causing the bomb image position to change on larger mobile screens or when zooming in. I ...

Display the exclamation point symbol after the hash symbol in the URL while navigating in AngularJS

I recently started learning AngularJS and decided to test out routing with a demo. Here are the relevant parts of my code: app.js var app=angular.module("tutorialApp",["ngRoute","tutorialCtrlModule"]); app.config(function($routeProvider){ $routeProvi ...

The background color changes only on a specific page by selecting a color from the color picker

I created a webpage with a color picker that changes the color of the action bar. However, the action bar color only changes once and I want it to change on all other pages as well. Below is the code I used: <h4>Color Picker</h4> <scrip ...

AJAX: Bringing in new content to display beneath the triggering page

Here is the code for my main page: <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <style type="text/css"> div { width:100%; ...

Guide to selecting a specific element in a loaded template depending on an *ngIf statement

I'm having trouble accessing an element in my template using a template variable as it keeps returning as undefined. At a specific route in my application, my component makes a call to fetch some data within the forkJoin method from rxjs. Due to the ...

modify the final attribute's value

Hello I've been using skrollr js to create a parallax website. However, the issue arises when determining the section height, as it depends on the content within. My goal is to locate the last attribute and adjust the number value based on the section ...

Adding a CSS class to an HTML element using JQuery

I have a collection of tabs, and I want to dynamically add an <hr> element with the class "break-sec" when a certain class is active. This element should be placed within a <span> element with the class "vc_tta-title-text" after the text. Here ...

Having trouble aligning my fixed div to the center of the screen

I have scoured numerous resources in search of a solution to my problem, but nothing seems to work for me. I have created a simple portfolio site where I want the word 'Developer' to be the first thing visible upon loading, followed by the portfo ...

What could be the reason behind the failure of this :after element?

I am facing an issue with the preloader on my webpage where the animation is not displaying as expected. The animation should appear on top of a dark black background before the page fully loads, but it seems to be missing. The CSS for the animation works ...

Tips for utilizing the viewport to ensure that mobile devices adjust to the width of the content

Currently, I am designing a book reader where the width of the book can vary, ranging from 1028px to 2000px to 560px. I want mobile devices to automatically scale the book to fit the screen width when viewing it. This is what I have been doing so far wit ...

Guide to dynamically loading HTML and scripts as requested by the user

As I embark on creating my first single page application, I am faced with a challenge. The application contains an overwhelming amount of HTML code that I do not want to be loaded all at once on the client side. Instead, I would like to load the HTML conte ...

Setting size using percentages in Semantic-UILet's explore how to define the size

Since discovering semantic-ui a few days ago, I've been impressed and have decided to switch my app from Bootstrap 3 to semantic-ui. I could use some assistance here. I'm attempting to split the body of the page into two parts. I would like the ...

The content of the HTML request may not always be displayed exactly as it appears in the browser

I've been trying to extract comments from a website using Python and urllib. Although I am successful in obtaining the HTML, I noticed that the comment section is missing. Here's what my Python code retrieves: <div data-bv-product-id="681012 ...

Manipulating Json files using node.js through the html input element (Front end development with AngularJs and Html)

I have multiple JSON array files that I need to read and display in the form of a table. The only editable part of the table should be the header, which corresponds to the keys of the JSON objects. This way, the user can customize the headers and those cha ...

What is the process for transferring a file to a different directory?

<html> <head> <title>Main Page</title> </head> <body> <h2>Main Page</h2> <form method="post" action="index.php" enctype="multipart/form-data"> <input type="file" name="filename"> <input type=" ...

Accessing Google Maps offline using HTML5 is a convenient and helpful

Our team is working on an HTML5 application that includes a Google map feature for changing search locations. Recently, we've added an offline version of the app as well. Is there a way to cache the Google map so that when the app is offline, it can s ...

Several modal windows on a single webpage

On this page I have implemented Bootstrap collapse and modal functionality. The issue I am facing is that when the user clicks on the "Anfrage" button (The yellow button), the modal pops up and works correctly. However, once the modal is closed, the inte ...

The dropdown menu in CSS is displaying only the final item on the list

Can anyone help me with my drop-down menu issue? It's only displaying the last items and I suspect there is something wrong with my CSS. Here are the details: HTML Code: <div class="menuBar"> <nav class="Menu"> <ul class="mai ...