For a while now, I've been attempting to transform my paragraph into a block within a section that showcases elements in an inline-flex layout

I have been attempting to adjust the paragraph with the errorDate class so that it displays as a block element directly beneath the input element similar to the image provided here. The section is currently set to appear as an inline-flex.

Below is the CSS code I modified, setting the display property to block for the errorDate class and inline-flex for the date class which is the parent element:

.date {
  display: inline-flex;
  flex-direction: row;
}

.errorDate {
  display: block;
}
<section class="date">
  <input type="datetime" class="mmname" id="mm" placeholder="MM" pattern="[01-31]{2}" required>

  <input type="datetime" class="yyname" id="yy" placeholder="YY" pattern="[00-99]{2}" required>
  <p class="errorDate"> Can't be blank </p>
  <!--CVC-->
  <div class="cVc">
    <label for="cvc" class="cvc">CVC</label>
    <input type="text" class="cvcname " id="cvcname" placeholder="eg. 123" pattern="[000-999]{3}" required>
    <p class="errorCvc">Can't be blank</p>

  </div>
</section>

Answer №1

Check out this link for more information on the distinction between display:inline-flex and display:flex.

To resolve your issue, simply move the error message "

<p class="errorDate">The date can't be blank</p>
" outside of the <section>. This adjustment should solve the problem effectively.

.date {
  display: inline-flex;
  flex-direction: row;
}

.errorDate {
  display: block;
}
<section class="date">
  <input type="datetime" class="mmname" id="mm" placeholder="MM" pattern="[01-31]{2}" required>
  <input type="datetime" class="yyname" id="yy" placeholder="YY" pattern="[00-99]{2}" required>
  <div class="cVc">
    <input type="text" class="cvcname " id="cvcname" placeholder="eg. 123" pattern="[000-999]{3}" required>
    <p class="errorCvc">The CVC can't be blank</p>
  </div>
</section>
<p class="errorDate">The date can't be blank</p>

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

Eliminating the glow effect, border, and both vertical and horizontal scrollbars from a textarea

Dealing with the textarea element has been a struggle for me. Despite adding decorations, I am still facing issues with it. The glow and border just won't disappear, which is quite frustrating. Could it be because of the form-control class? When I rem ...

Submitting an HTML form to trigger a PHP function through AJAX

I am currently working on a task that involves POSTing an email address entered in an HTML form to a PHP script for storage in a database. The script should also handle error messages if the user inputs an invalid email address. I want to make this process ...

Keeping information saved locally until an internet connection is established

I have a vision to develop a Web app focused on receiving feedback, but the challenge lies in the fact that it will be utilized on a device without an internet connection. The plan is for it to save any user input offline until connectivity is restored. Th ...

Create a regular expression that permits a sequence of numbers (either integer or decimal) arranged in groups of up to five, with each

Is it possible to create a regular expression that allows integers and decimals? var reg = /^((\s*)|([0-9]\d{0,9}(\.\d{1,3})?%?$))$/.; How can users input 0 to 5 groups of integers and decimals separated by |? Updated: This regex sh ...

Updates made to CSS are not reflecting on the error 404 page

Unable to Apply CSS Changes to 404 Error Page EDIT: page in question: Right from the start: I have ruled out any relative path issues. I have specified a base href in my header like this: <base href="https://hinnahackers.no/"> I am aware that thi ...

JQuery fixed div bounces unpredictably when scrolling

Currently, I have a scenario on my webpage where there is a div called RightSide positioned on the far right side below another div named TopBanner. The TopBanner div remains fixed at the top of the screen even when the user scrolls down, which is exactly ...

Stop the scrolling behavior from passing from one element to the window

I am facing an issue with a modal box window that contains an iframe. Inside the iframe, there is a scrollable div element. Whenever I try to scroll the inner div of the iframe and it reaches either the top or bottom limit, the browser window itself start ...

Scraping data from Mass Lottery's website with the help of Beautiful Soup

I am currently using beautiful soup to extract all the keno numbers that have ever been drawn. While I have a good understanding of how to achieve this, I am encountering an obstacle. My goal is to retrieve both the game numbers and the corresponding winni ...

How can I use jQuery to reset a select dropdown to its initially selected option upon page load?

Can a select element be reset to its original loaded option using jQuery without the need for creating a custom cache of the initial value? ...

SwipeJS is not compatible with a JQuery-Mobile web application

I am currently attempting to integrate SwipeJS (www.swipejs.com) into my JQuery-Mobile website. <script src="bin/js/swipe.js"></script> <style> /* Swipe 2 required styles */ .swipe { overflow: hidden; ...

"jQuery Ajax function running smoothly on my local machine, but encountering issues when deployed on the server

I have explored extensively across the web in search of a solution to this issue. I possess a jquery ajax script that loads a csv file and creates html code by utilizing the data from the csv file. <script type="text/javascript"> $(document). ...

Improving the efficiency of rendering multiple objects on a canvas

I'm currently working on developing a simulation for ants using the basic Javascript canvas renderer. Here is a snippet of the rendering code: render(simulation) { let ctx = this.ctx; // Clearing previous frame ctx.clearRect(0, ...

What is the best way to create a more compact Select component in React?

Working on React's Select component has been quite the challenge for me. I'm in the process of creating a simple dropdown button, also known as a ComboBox, similar to what can be seen on GitHub Insights: https://i.stack.imgur.com/J9Bcd.png Belo ...

Text transitions in a gentle fade effect, appearing and disappearing with each change

I want to create a smooth fade in and out effect for the text within a div when it changes or hides. After researching on Google and Stack Overflow, I found that most solutions involve adding a 'hide' CSS class and toggling it with a custom func ...

How to Retrieve the Following Element in a Table Using Javascript

https://jsfiddle.net/en6jh7pa/1/ I am encountering an issue with accessing the next element, as it is returning null. When I pass "this" as the onclick parameter, I expect to be able to grab the next element using this keyword. However, it seems to be re ...

Hiding a Blogger section when its widget is not visible

Take a look at this code: <b:section id='page-list'> <b:widget id='PageList1' locked='false' type='PageList' version='2' visible='true'> </b:widget> </b:section> I wa ...

Revamping the design of a menu bar in WordPress

I designed a navigation bar and now I'm looking to customize the CSS for it in WordPress. Specifically, I want to be able to reference the nav bars by name from PHP to CSS. It seems like there are just two dots representing variables. Here is the co ...

Struggling to position search form to the right side of an <li> element

I'm having trouble aligning my search bar to the right side of the navigation menu items. HTML: <body> <div id="navbox"> <nav id="nav"> <ul id="nav"> <li><a href="#">Home< ...

CSS3: What is causing this issue in FireFox?

http://jsfiddle.net/tNg2B/ It's clear that there is a noticeable difference when viewing this in Chrome compared to Firefox. The ":before" and ":after" pseudo classes seem to be malfunctioning in Firefox. Is there a way to resolve this issue? Edit: ...

I'm having trouble getting Jquery's insertAfter() function to function properly

After creating a parent div and using jQuery's insertAfter() method to insert additional divs, an unexpected issue arises. The first record goes to the bottom, while subsequent records are inserted above it. Below is the function in question: functi ...