Steps for creating a horizontal card design

Looking to achieve a card style similar to this: http://prntscr.com/p6svjf

How can I create this design to ensure it remains responsive?

<div class="recent-work">
    <img src="work/mercedes.png">
    <h3>Modern website concept</h3>
    <p>Encountering an issue here</p>
</div>
.recent-work {
    background-color: black;
    width           : 100%;
    height          : 50%;
    padding-top     : 10%;
}

.recent-work img {
    width: 750px;
}

.recent-work p {
    color  : white;
    display: inline;
}

.recent-work h1 {
    color: white;
}

Answer №1

Using flexbox can help divide the card into two parts for separate styling

Check out this example:

.recent-work {
  display: flex;
  padding: 30px;
  background-color: black;
}

.recent-work .pic {
  flex-shrink: 0;
  flex-basis: 40%
}

.pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-work p {
  color: white;
  display: inline;
}

.desc {
  margin-left: 40px;
}

.recent-work h1 {
  margin: 0;
  margin-bottom: 20px;
  color: white;
}

@media (max-width: 900px) {
  .recent-work {
    flex-direction: column;
  }
  .desc {
    margin-left: 0;
  }
}
<div class="recent-work">
  <div class="pic">
    <img src="https://picsum.photos/536/354">
  </div>
  <div class="desc">
    <h1>Modern website conecept</h1>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi reiciendis suscipit repudiandae, exercitationem perferendis eligendi. Saepe, nesciunt explicabo! Maxime deserunt necessitatibus perferendis nesciunt ratione est nihil voluptatum doloremque
      fugit ipsam.</p>
  </div>
</div>

See it in action on CodePen

https://i.sstatic.net/2Fgwl.png

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

Issues with the TableSort plugin in asp.net

Let's get started: I have a basic table in an ASP page <table id="provasort" class="tablesorter"> <thead> <tr> <th>head1</th> <th>heade2& ...

Show the "Splash" picture, then switch to a newly uploaded image and show it for a set amount of time

I am in the process of developing an HTML/JavaScript page that will showcase a splash image (splash.jpg) until it gets replaced by another image file called latest.jpg. Once this latest.jpg is displayed, I want it to remain on the screen for 90 seconds bef ...

The behavior of the CSS Position property is exhibiting unique characteristics when used in

I am encountering an issue where an image is displaying differently based on the position attribute in Firefox compared to Chrome and IE11. Take a look at the preview on . Notice how the bottom tip of "Fountain Valley" is incorrectly positioned in Firefox ...

Enhance the appearance of a dropdown selection using CSS

I am interested in customizing the appearance of the first option (Search Clubs) to be bold, while keeping the rest with normal font weight. Currently, I am able to make the first option bold, but it only appears that way after clicking the dropdown menu ...

The paragraph tag remains unchanged

I am currently working on developing a feature that saves high scores using local storage. The project I'm working on is a quiz application which displays the top 5 scores at the end, regardless of whether the quiz was completed or not. However, I&apo ...

Internet Explorer and Edge browsers are concealing box shadow behind the parent div

When using an input slider range, the box-shadow is being applied to the active thumb in all browsers except for IE & EDGE. In these browsers, the shadow is cutting or hiding behind the parent div #c. I have already tried setting overflow:visible on the p ...

Disabling Scrolling in AngularJS Material Tab Components

I'm experimenting with AngularJS Material components and struggling with creating tabs. Every time I add a tab, the content inside the child md-content element automatically gets a fixed height with a vertical scrollbar instead of adjusting its heigh ...

I attempted to activate the hover effect on a DOM element using JavaScript, but was unsuccessful. It appears that achieving this is not possible. However, I am curious as to how Chrome is able to

I attempted to activate the hover state of a DOM element using JavaScript, but had no success. It appears that this task is not achievable in the way I initially approached it. I have heard that creating a class with a hover function and then adding or ...

Creating HTML form input fields for reading and writing an XML file

Currently working on constructing an HTML form containing input fields to read and modify data from an XML file. The initial task involves loading values into the input fields upon page load, but unfortunately, it is not functioning as expected. < ...

Is there a way to remove the unwanted code ​ from the client side of my website?

Upon inspecting the source code of a webpage, I noticed an odd character ​ appearing before the <script> tag on the client side. Strangely, this mysterious character is not present anywhere in the server-side PHP file. I attempted removing a ...

What is the recommended sequence for adding AngularJS to the index page?

I am new to AngularJS and currently working on a project where I need to include multiple JavaScript files in my index.html page. After doing some research, I came across a post on Stack Overflow that mentioned the importance of including the angular.js fi ...

Group in group, glitch in outdated browser

Facing an issue with IE6 while writing HTML/CSS code. I am looking to create dynamic divs using classes: Here is a simple example (not real-project code): .top {width: 50px;} .top.selected {background: #f00;} .mid {width: 114px;} .mid.selected {backgrou ...

Incorporating fresh data from a node.js backend to refresh a webpage section

I'm currently working on creating an app that can retrieve the song a user is currently listening to using a web scraper. While I've managed to direct users to the page and display the current song title, they must manually refresh the entire pag ...

Tips for displaying a multi-select dropdown in the Creative Tim Angular Material Pro filter panel

I am in need of assistance with modifying the standard Creative Tim Angular Pro Material template due to my limited CSS/SCSS skills. Could someone provide examples of the necessary changes, whether it involves altering the HTML or multiple CSS files withi ...

Preventing Redropping: A jQuery Drag and Drop Feature to Ensure Dropped Elements Stay Put

After implementing Drag & Drop functionality using jQuery, I have encountered a specific issue. The problem: When the dropped element (drag 1) is removed from the droppable container, it reverts back to the draggable container. Subsequently, attempting to ...

Restricting a checkbox to a maximum of 5 checkmarks

In a multi-column table, each column is represented by a checkmark. I want to limit the ability to tick a checkmark to only 5 checkmarks. Here is the code that has been implemented: <tbody> <ng-container *ngFor="let col of testData" ...

Laravel error message for unresolved symbolic link

Previously, I had developed a form for uploading profile pictures using the code snippet below, $image = $request->file('avatar'); $pass = Hash::make($request->password); if($image!=null){ $avatar_na ...

Is there a method in PHP to conceal HTML code?

Although I understand that obfuscated html/js code may seem unnecessary to some (I've read similar questions on SO), I still want to add an extra layer of protection against potential copycats of my site... My website is php-based and generates html ...

What is the best way to utilize the @Import CSS rule in my code?

After using CSS for a considerable amount of time, I have successfully utilized the @import rule in the past. However, I am currently encountering an issue with it on a new project. Is there anyone who can offer assistance? Here is the code: @import url(&a ...

Bootstrap failing to enclose columns that do not have a specified size

As I dive into creating a Bootstrap grid website to expand my knowledge, I am following the guidelines provided here. Trying to replicate the examples from that page has led me to the first hurdle. The issue arises when dealing with columns without specif ...