Setting the flex direction to column and enabling wrapping will allow the flex items to overflow

A basic design I'm aiming for with minimal use of html tags

Utilizing only <img>, <h1>, and <p> tags without any additional elements

Implementing flexbox with column layout and wrap feature

The primary column displays a single image

The secondary column houses the title and content

The parent container has fixed width and height dimensions

This may cause text to overflow beyond its boundaries

To address this, only specify width for <p> element

Is there a way to automatically break text without setting a specific width?

HTML

*{
      margin: 0;
      padding: 0;
    }
    .out{
      width: 600px;
      height: 200px;
      border: 1px solid #ccc;
      padding: 20px;
      margin: 50px auto;
      font-family: Verdana;

      display: flex;
      flex-direction: column;
      flex-wrap: wrap;
    }
    img{
      /* margin-bottom: 20px; */
      margin-right: 20px;
    }
    p{
      line-height: 1.6;
      overflow-wrap: break-word;
    }
<div class="out">
    <img src="https://picsum.photos/id/230/200/200" alt="">
    <h1>This is Title</h1>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta iure iusto cupiditate sequi aperiam, nostrum optio ipsam dicta modi officiis eligendi vel. Dignissimos delectus exercitationem nemo. Enim id sed corrupti!</p>
</div>

Answer №1

Here is an alternative solution based on your expectations:

* {
  margin: 0;
  padding: 0;
}

.out {
  width: 600px;
  height: 200px;
  border: 1px solid #ccc;
  padding: 20px;
  margin: 50px auto;
  font-family: Verdana;
  display: flex;
}

img {
  /* margin-bottom: 20px; */
  margin-right: 20px;
}

p {
  line-height: 1.6;
  overflow-wrap: break-word;
  margin-left: -200px;
  margin-top: auto;
  margin-bottom: auto;
}

h1 {
  position: relative;
  white-space: nowrap;
}

p::before {
  content: "";
  width: 100%;
}
<div class="out">
  <img src="https://picsum.photos/id/230/200/200" alt="">
  <h1>This is Title</h1>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta iure iusto cupiditate sequi aperiam, nostrum optio ipsam dicta modi officiis eligendi vel. Dignissimos delectus exercitation nemo. Enim id sed corrupti!</p>
</div>

Answer №2

Check out my unique approach

* {
  font-family: 'arial';
}

.card {
  display: block;
  padding: 20px;
  border: 2px solid #333333;
}

.content {
  margin-left: 15px;
}

.content h6 {
  margin-top: 10px;
  font-size: 28px;
  margin-bottom: 7px;
}
<div class="card">
  <img src="//via.placeholder.com/200">
  <div class="content">
    <h6>Unique Title</h6>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. 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.</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

Dealing with Bootstrap 3 compatibility issues in IE8: Finding solutions for mobile-like behavior

Currently, I am in the process of completing this website at . Most aspects of the site display properly on all standard browsers, however, there seems to be an issue with IE8. It appears as if the layout is behaving like a mobile view, with all containe ...

Trouble with setting the width of a fixed element within a parent div

My goal is to make an element's position fixed and have it take up the full width of its parent div. Below is the HTML I am working with: <div class="col-md-3"> <div class="player-avatar-card"> <div class="card-b ...

Connect jQuery's resizable controls

Check out this jSFiddle. I am attempting to add event handlers for resizing $('oWrapper_'+num). However, the resizing does not occur. This is because $('#oWrapper_'+num) has not been added to the dom at the time of execution, so the se ...

My element's padding being overlooked by Tailwind CSS

In the process of developing a comment/response mechanism through MPTT, I am utilizing indentation to clearly designate replies and their respective levels. The comment.level attribute is being employed to establish the padding value. Consequently, a comm ...

Updating disabled date picker appearance in Angular Material Design

I am currently developing a website using Angular Material. One of the components I am working with is a date picker. The issue I am facing is that the date picker has the popup functionality enabled, but the input itself is disabled, causing a dotted line ...

Tips for setting the style of child components in a ReactJS project with CSS modules, classNames, and JSX syntax

Currently in the process of setting up a project using React JS and I am interested in incorporating auth0 for authentication purposes, along with potentially integrating some serverless functions. auth0 conveniently offers a pre-made "seed" project at ht ...

Dual columns filling the entire page within a container

Is there a way for me to pass the background images dynamically through inline styles? I can achieve this easily with pseudo elements, but I would like the content of the right and left columns to be enclosed in a container. You can view my proposed soluti ...

Tips for customizing stepper color using hooks in Material UI

Looking for help to change the color of a stepper from 'primary' to 'success' using React hooks. The stepper component does not have a built-in color method like an icon, so I'm struggling to find a solution. Any advice would be gr ...

Using SASS variables in JavaScript: A guide

My JavaScript file contains a list of color variables as an Object. export const colors = [ { colorVariable: "$ui-background" }, { colorVariable: "$ui-01" }, { colorVariable: "$ui-02" }, ... ] The Object above is derived from a scss file whic ...

Dependency on the selection of items in the Bootstrap dropdown menu

I am currently struggling with a few tasks regarding Bootstrap Dropdown Selection and despite looking for information, I couldn't find anything helpful. Check out my dropdown menu Here are the functions I would like to implement: 1) I want the subm ...

the border only partially encasing the div

In this snippet of code, the structure is not fully encapsulated within the div element. There are two child divs positioned in a row format. Bootstrap and inline CSS styles have been utilized for the CSS styling. This particular code segment pertains to a ...

How do I apply a xPage page style using the styleClass attribute instead of directly using the style attribute

Would like to know how to change the background color of an entire page using styleClass instead of directly in the xp:view tag? Here's an example that works: <xp:view xmlns:xp="http://www.ibm.com/xsp/core" style="background-color:#f1f1f1;"> ...

Troubleshooting issue: Inability to assign classes to child elements within divs of a designated class

Currently, I am facing an issue while attempting to insert divs into multiple divs that share a common class called ".description". My goal is to assign a unique class to each internal div, but for some reason, this only seems to work for the first div w ...

The issue with line-height causing the sliding URL effect to malfunction

Having a sliding underline URL effect (viewable here: http://codepen.io/Dingerzat/pen/XNgKmR), I encountered an issue when combining it with a resizing header. The resizing header caused the sliding underline effect to stop working. After some troubleshoot ...

Is there a way to collapse child elements in a hover sidebar using Vuetify?

My project includes a sidebar that opens when I hover over it with the mouse. Everything works fine, but within the sidebar, there is a collapse dropdown menu. When I open this menu and then move the mouse away from the sidebar and back again, the collapse ...

Safari fails to refresh CSS when it comes to dynamic attributes

Take a look at this simple demonstration: http://jsfiddle.net/fE8ry/ I am attempting to modify the attribute of a div, and based on the attribute's value, apply the corresponding CSS. When the page loads, the attribute selector functions correctly a ...

Display a div in landscape orientation alongside a div in portrait orientation on a single print

Is it possible to print one part of a web page in landscape orientation and another in portrait? If so, how can this be achieved? Here is a scenario: I am creating a web page that includes an image in one div and a table in another div. The image should b ...

Is there a way to initiate an Edge animation when an onclick event occurs?

I am interested in incorporating an interactive Adobe Edge animation that activates upon the click of a conventional HTML form button. Could you please guide me on how to achieve this? ...

What is preventing me from translating an element using transform: translateY()?

I attempted to move the letter 'h' down by 40px on its own, but the translation only seems to work if I relocate the entire word. I also experimented with positioning 'h' absolutely relative to the parent element, but then 'ello&ap ...

Jquery solution for a fixed footer on a window

I come across a solution (which includes a helpful screen rewrite fix in the comments by Luco) that fits my needs perfectly. Here is the revised code that has been fixed and tested: // Utilizing window load event to account for image-dependent window heig ...