Tips for effectively displaying elements on a page

After making changes to my css/html code, all the elements within a div are now displayed in a single line instead of appearing as separate <p>contents</p> tags with each on a new line. An example of this issue can be seen here:

Dealing with Css and html coding.

.card {
  /*    width: 320px;*/
  /*    height: 75px;*/
  position: relative;
  perspective: 1000px;
  margin-bottom: 15px;
  border: 3px solid white;
}

.front,
.back {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  position: absolute;
  top: 0;
  left: 0;
  /*    width: 100%;*/
  /*    height: 100%;*/
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 1s;
  backface-visibility: hidden;
}

.front {
  background-color: #fff;
}

.back {
  background-color: #f1c40f;
  transform: rotateY(180deg);
}

.card:hover .front {
  transform: rotateY(180deg);
}

.card:hover .back {
  transform: rotateY(360deg);
}

.item {
  border: 1px solid red;
}

.container {
  margin-top: 30px;
}

.item {
  margin-bottom: 15px;
  margin-right: 50px;
}

.places {
  color: red;
}

.discount {
  color: green;
}

.timestamp {
  color: blue;
}

.card {
  height: 200px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />

<!--main contents of the page in blocks form for each item-->
<div class="container">
  <div class="row">
    <?php $k=1 ?>
    <?php foreach($requests as $request) : ?>
    <div class="item col-md-3 col-sm-12" id="content<?php echo $k ?>">
      <div class="card">
        <div class="front">
          <p class="telegram_id">
            integer id
          </p>
          <p class="restaurant_name">

          </p>
          <p class="places">
            place count
          </p>
          <p class="discount">
            dicount
          </p>
          <p class="timestamp">
            time updated at
          </p>
          <button type="button">Wanna order</button>
        </div>
        <div class="back">
          random contents
        </div>
      </div>
    </div>
    <?php $k+=1 ?>
    <?php endforeach; ?>
  </div>
</div>
<!--main contents end is here-->
<!--jquery-->

https://jsfiddle.net/pr3w1k8x/

Thank you!

Answer №1

The style in the CSS for the class .back includes display:flex, but it is recommended to remove that in order to achieve your desired layout with each answer appearing on a new line.

Answer №2

Eliminate the display:flex styling from the .front element

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

Arranging card images in a row using semantic cards for optimal alignment

Trying to create a row of semantic-ui cards with images at the top, I ran into an issue with varying image heights causing different card title positions. The goal is to have all images be the same height while still adapting to larger screens. Although I ...

Displaying divs depending on dropdown selection - Troubleshooting script issue

When I try to display certain divs based on dropdown selection using the script below, it works fine on a simple page. However, when I implement it on my current development page, it completely messes up the layout, turning everything black and adding stra ...

What is the best way to shift all elements to the right side except for 'tindog'?

https://i.sstatic.net/hAUps.png <nav class="navbar navbar-expand-lg navbar-dark "> <a class="navbar-brand" href="">Tindog</a> <button class="navbar-toggler" type="button" data-t ...

Changing the background image within a CSS class on an imported Vue component

Is there a way to dynamically change the background-image on a CSS class within an imported component? I have successfully installed 'vue-range-slider' and imported RangeSlider. The setup for the range-slider is as follows: <template> ...

Creating a Chrome extension that opens multiple tabs using JavaScript

Currently, I am working on a chrome extension that includes several buttons to open different tabs. However, there seems to be an issue where clicking the Seqta button opens the tab three times and clicking the maths book button opens the tab twice. Below, ...

Enhancing functionality by integrating Jquery/JS with input fields and labels

I am currently facing a challenge in applying CSS to the label element when the corresponding input is selected. After attempting and failing to use input:checked + label due to limitations in the HTML structure that cannot be altered, I seek alternative ...

PHP 7.2 does not allow code to reference previously set sessions

Currently, I am utilizing sessions to transmit either a success or error message to the subsequent site by employing an included PHP file (message.php) to exhibit said message. Unfortunately, for unknown reasons, the message.php file is unable to referenc ...

Utilizing jQuery to Maintain State Across Page Refreshes with Cookies

Currently, I am attempting to create a script that can retain its state even after the page is refreshed. Here is my progress so far: Utilizing jQuery: $(window).ready(function() { var voteId = $('.gallery-item a'); $(voteId).click(function() ...

Getting form field values with JQuery

I am currently facing an issue with a form field in HTML. Here is the code snippet: <form id="tasklist"> <input type="text" id="name" ...></input> ... additional form elements go here ... </form> Although I am trying to retrie ...

What is the best way to disable stacking toasts in bootstrap?

I have been experimenting with stacking Bootstrap toasts, but I am encountering an issue with the close buttons not functioning as expected. Currently, I am only able to close the most recent toast and none of the others. My attempt at adding an event lis ...

I am facing an issue with the asynchronous function as it is displaying an error message

**I am facing an issue with displaying categories. I have attempted to do this using async function, however the data is not showing up** <div class="form-group"> <label for="category">Category</label> <select id="categor ...

What are the steps to designing a Vertical Curve UI?

Is there a way to replicate the unique vertical curve on the login page, as shown in the image below? I've come across horizontal SVGs that can achieve this effect, but I'm struggling to find resources on implementing it vertically. How is this ...

The swf file doesn't stretch to fit the window when the height is set to 100%

Struggling with creating a flash recorder controlled by JavaScript? Trying to get the flash to fill the browser window but disappearing when setting height or width to 100%? Where am I going wrong? <div id="flashrecorder"> <object wmode="trans ...

Tips for keeping a Youtube video playing even after the page is refreshed

Is it possible to save the current position of a Youtube video and have it resume from that point when the page is refreshed, instead of starting from the beginning? I am considering using cookies to store the last position or utilizing GET. Although my w ...

Common Error for Novice HTML/CSS Learners

I am currently enrolled in an introductory web design course on Treehouse, and I have encountered a problem with centering a class in HTML using CSS. Despite following the instructions closely, my code is not displaying correctly. Can someone please review ...

How can you verify a phone number input?

I have a phone number field in my form that needs validation. The conditions are that the numbers may be 8 digits or 10 digits long, otherwise an error message should be displayed. Is this code snippet correct? <input class="form-control" name="phone_n ...

The property cannot be set for an undefined element in Jquery UI slider tabs

There seems to be some extra space at the bottom of the slider tabs between the navigators and content. Additionally, I am facing a challenge in making the page responsive as the content size does not adjust when I resize the window. To see the changes, I ...

Make sure to define the image path in the CSS file of your WordPress project

When working on my WP 4.2 project, I encountered a situation in the CSS file where I had to write: background-image: url('/wp-content/plugins/artistssongs/images/fancybox_sprite.png'); However, I find it inconvenient to display the full path to ...

Arrange the input fields on a single line in Rails for a clean and organized layout

Below is a Rails code snippet for input fields. Name:-<%=text_field_tag "specification[name1]","",:class=>"autocomplete form-control"%> <br/> Value:-<%=text_field_tag "specification[value1]","",:class=>"autocomplete form-control"%> ...

Prevent certain HTML content from being displayed in the input field

My input field behaves like a chat box where users can enter text that gets displayed on the page. However, I've discovered that users can also include HTML tags in their inputs to manipulate the output. For example, entering <b>Hello</b> ...