How can I display my buttons on their own line within a flexbox

Abow

I am trying to display the <h1> on it's own line as well as the <h3> and all the buttons on 1 line together. I am using flex and I know how to do this normally, what I tried to do was display: block; on the buttons and h3 to have them on their own lines, this didn't work and I tried googling my way and finding some kind of flexbox guide to figure it out myself.

body {
  margin: 0%;
  background-color: #6987D5;
  font-family: Arial, Helvetica, sans-serif;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.container h1 {}

.container button {
  border: 0px;
  background-color: #315dcc;
  padding: 1%;
  color: white;
}
<div class="container">
  <h1>Stopwatch</h1>
  <h3>00:00</h3>
  <button type="button">Start</button>
  <button type="button">Stop</button>
  <button type="button">Reset</button>
</div>

Carlotta

You have to add a <div> around the buttons to combine them.

body {
  margin: 0%;
  background-color: #6987D5;
  font-family: Arial, Helvetica, sans-serif;
}

.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.container h1 {}

.buttons {
  display: flex;
}

.container button {
  border: 0px;
  background-color: #315dcc;
  padding: 1%;
  color: white;
}
<div class="container">
  <h1>Stopwatch</h1>
  <h3>00:00</h3>
  <div class="buttons">
    <button type="button">Start</button>
    <button type="button">Stop</button>
    <button type="button">Reset</button>
  </div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

DataTables - How can I use my own buttons for exporting?

How can I configure mutt to display my replies within threads?

How do I display my 'findall' results on it's own separate line?

How can I put my bootstrap buttons in a vertical line going down in the centre of my webpage?

How can I see if my password variable is within a line so that my code can proceed?

How can I get my buttons to hide/display properly when I click them?

How can I display select options as buttons?

How can I display all of the question together with their own choices in my view?

How can I return my own promise?

How can I host my own website

How can I customize my own Observable?

How can I generate my own ScalaSig?

how can I spider my own website

How do I use a Codeigniter method within my own function?

How do I add missing 'IChainable' properties to my own construct so that I can use it within a state machine definition?

How can I map keyboard buttons to my mouse buttons?

How can I display my javascript inside my <p> tags to make it a one line sentence?

How can I display the details of a EKEvent invitation within my app using EKEventViewController?

How can I display custom content in vue-good-table within my view-side component?

How can I center individual images within their own background boxes?

How do I center my nav bar on its own line?

How to I get my label and radio/checkbox buttons to be in the same line?

How can I make the display of a line in my command-line java program change without displaying a new line?

Why can't I get my buttons to have a margin at the top (CSS Flexbox)?

How can I display my video bitrate in MBps using MediaInfo on the command line with --Inform

How can I display my element(`class="line"`) over all other elements/div?

I can't figure out how to display this data in a separate line in my html from JS

how to add <br> tag on dom(vanilla javascript)? I can't display my next loop on new line

I can't seem to get these two buttons line up buttons like this. How can I do this?