white-space: nowrap;
However, the above does not work on Safari. In Safari, use this instead:
white-space: pre; overflow-x: auto; word-wrap: normal;
https://stackoverflow.com/questions/657795/how-to-remove-word-wrap-from-textarea/25556711#25556711
white-space: nowrap;
white-space: pre; overflow-x: auto; word-wrap: normal;
<div id="parent">
<div id="child">hello world</div>
</div>
Centering with margin, it has to be done at child level:
#parent {
width: 50vw;
height: 50vh;
background-color: gray;
display: flex;
}
#child {
margin: auto;
}
Try it at: https://jsfiddle.net/xd7uwgn8/
#parent {
width: 50vw;
height: 50vh;
background-color: gray;
display: flex;
justify-content: center;
align-items: center;
}
#child {
}
Try it at: https://jsfiddle.net/xd7uwgn8/2/
<div id="parent">
hello world
</div>
Try it at: https://jsfiddle.net/xd7uwgn8/3/
.container {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
Details: scotch.io: Centering things with CSS Flexbox
<div id="band">
<div style="background-color: red">John</div>
<div style="background-color: green">Paul</div>
<div style="background-color: blue">George</div>
<div style="background-color: yellow">Ringo</div>
</div>
<style>
body {
background-color: slategray;
display: flex;
justify-content: center;
align-items: center;
}
#band {
background-color: white;
margin: 0 auto;
border-style: solid;
border-width: 2px;
max-width: 740px;
width: 100%;
display: flex;
/* justify-content: flex-start; */ /* flex-start is the default justify-content */
flex-wrap: wrap;
}
#band > div {
width: 200px;
height: 200px;
/* center all the names inside each box */
display: flex;
justify-content: center;
align-items: center;
}
</style>

display: flex; justify-content: center; flex-wrap: wrap;

display: grid; justify-content: center; grid-template-columns: repeat(auto-fit, minmax(200px, max-content));

display: grid; justify-content: end; /* flex-end works as well, but we will just be confusing ourselves with that, we are using grid not flex */ grid-template-columns: repeat(auto-fit, minmax(200px, max-content));

display: flex; justify-content: flex-end; flex-wrap: wrap;


display: grid; justify-content: end; grid-template-columns: repeat(auto-fit, minmax(200px, max-content));

display: flex; justify-content: flex-start; flex-wrap: wrap;
display: grid; justify-content: start; grid-template-columns: repeat(auto-fit, minmax(200px, max-content));
<div class="form-group">
<label id="recommend-label" class="label">Would you recommend freeCodeCamp to a friend?</label>
<label><input type="radio" name="recommend" value="definitely">Definitely the greatest tutorial on earth</label>
<label><input type="radio" name="recommend" value="maybe">Maybe</label>
<label><input type="radio" name="recommend" value="not-sure">Not sure</label>
</div>
<style>
.form-group label:not(.label) {
display: block;
background: lightgreen;
margin: 2px;
}
</style>
<div class="form-group">
<label id="recommend-label" class="label">Would you recommend freeCodeCamp to a friend?</label>
<div>
<label><input type="radio" name="recommend" value="definitely">Definitely the greatest tutorial on earth</label>
</div>
<div>
<label><input type="radio" name="recommend" value="maybe">Maybe</label>
</div>
<div>
<label><input type="radio" name="recommend" value="not-sure">Not sure</label>
</div>
</div>
.form-group label:not(.label) {
display: inline-flex;
background: lightgreen;
margin: 2px;
}