Certain letters overflowing their container - can anything be done? - css

I have noticed the problem of certain letters overflowing their container on the left side, but I haven't seen anyone actually bringing up the problem.
I've tried between a few different font-families, but they all seem to have the same problem.
JSFIDDLE: https://jsfiddle.net/3h5poynt/
HTML (angular)
<div class="personal-profile container-column">
<mat-card class="header">
<section class="cover-section"></section>
<section class="intro-section">
<div class="intro-header">
<div class="profile-photo-wrapper">
<img src="/assets/img/profile-picture-placeholder.png" alt="" class="profile-photo" />
</div>
<div class="badges-container">
<ul class="badges-list">
<li>
<img
src="/assets/badges/business-plans-180x180.png"
alt="Business plan"
matTooltip="Something"
matTooltipClass="badge-tooltip"
matTooltipPosition="above"
/>
</li>
<li><img src="/assets/badges/calling-customers-180x180.png" alt="Calling customers" /></li>
<li><img src="/assets/badges/finance-180x180.png" alt="Finance" /></li>
<li>
<img src="/assets/badges/selling-to-customers-180x180.png" alt="Selling to customers" />
</li>
<li><img src="/assets/badges/social-media-180x180.png" alt="Social media" /></li>
</ul>
</div>
</div>
<div class="info-container">
<div class="personal-info">
<div class="name-text">{{ profile ? profile.name : '' }}</div>
<div class="description">{{ profile ? profile.personal_description : '' }}</div>
</div>
<div class="additional-info"></div>
</div>
</section>
</mat-card>
SCSS
#import '../../../variables';
.mat-card {
padding: 0;
overflow: hidden;
section {
padding: 20px;
}
}
.badge-tooltip {
background: #3f51b5;
color: white;
font-family: $font-open-sans;
}
.personal-profile {
margin-top: 50px;
.header {
min-height: 500px;
width: 100%;
.cover-section {
background: url('/assets/img/coverpicture.png') center/cover;
height: 225px;
}
.intro-section {
.intro-header {
size: auto;
.profile-photo-wrapper {
position: relative;
margin-top: -87px;
display: inline-block;
.profile-photo {
width: 150px;
height: 150px;
border: 4px solid white;
border-radius: 10px;
box-shadow: inset 0 1.5px 3px 0 rgba(0, 0, 0, 0.15), 0 1.5px 3px 0 rgba(0, 0, 0, 0.15);
background-color: #fff;
}
}
.badges-container {
vertical-align: middle;
display: inline-block;
margin-top: -87px;
.badges-list {
list-style: none;
li {
float: left;
padding: 0 10px 0 10px;
img {
width: 40px;
height: 40px;
}
}
}
}
}
.info-container {
padding-top: 15px;
display: grid;
grid-template-columns: 1fr 1fr;
font-family: $font-open-sans;
.personal-info,
.additional-info {
display: flex;
flex-direction: column;
}
.personal-info {
.name-text {
font-size: 1.3em;
}
}
}
}
}
}
Main SCSS
/* You can add global styles to this file, and also import other style files */
#import '~#angular/material/prebuilt-themes/indigo-pink.css';
#import '_variables.scss';
* {
margin: 0;
padding: 0;
font-family: $font-open-sans;
}
html {
font-family: 'Roboto', sans-serif;
}
html,
body {
height: 100%;
width: 100%;
background-color: #e9ebee;
}
.container-column {
display: flex;
flex-direction: column;
width: 80%;
margin: auto;
}
.container-row {
display: flex;
flex-direction: row;
width: 80%;
margin: auto;
}
Is there something very essential that I am missing, or is this something that has to be hacked?

Jonas,
Some fonts are "just like that".
You will find that (especially with some of the more amateurish free fonts available nowadays) that some fonts' descenders, ascenders, ornaments, etc just overlap the borders that we (programmers, readers) expect them to conform to.
If you really want to use a font like this in this specific context, then you have to program around the font's limitations.
In your fiddle, I merely added padding-left to the name-text style:
.name-text{
font-size: 1.3em;
font-family: "Open Sans", sans-serif;
background: red;
padding-left:15px; /* voila! */
}
Give it a try in the fiddle.
If the left bearing is radically different on initial characters across the font, then you maybe able to set up various styles with padding that changes according to the substring value of the first character. Sounds like a bit of a living hell to program that, but if you really want it, there you go.
Or you could just pick a different font.

Related

Is it possible to combine position relative and fixed on the same element?

I'am making a Navbar to a website and I want it to be fixed at the top , so that when I scroll down the navbar is still acessible.
However, the NavBar position is relative (should be fixed , I know) because I have absolute elements which are relatively positioned to it.
If I change the position from relative to fixed the navbar looks and background color fall apart.
You can see the code below :
CSS
#cabeçalho{
position: relative;
background-color: rgba(0, 0, 0, 0.6);
height: 110px;
}
header h1{
margin: 3px;
color: white ;
font-size: 55px;
font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, Georgia, sans-serif;
}
header p{
position: absolute;
color: white;
font-size: 25px;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif ;
transform: translate(95px , -20px);
}
ul {
margin: 0px;
padding: 0px;
position : absolute;
transform: translate(950px , -20px);
}
li{
display: inline ;
border: 1px solid white;
font-size: 15px;
padding: 10px;
margin: 5px;
color : white
}
HTML
<div id="cabeçalho">
<header>
<h1>Joana Bonvalot</h1>
<p>Artista - Pintora Clássica<p>
</header>
<ul>
<li>Página Inicial</li>
<li>Galeria</li>
<li>Encomendas</li>
<li>Contactos</li>
</ul>
</div>
I would like to know if there is any way I can make the navbar element position fixed but also relative in order to make the absolute elements stay in place.
Put all the elemets in the navbar tag and give it style position: relative so the absolute positioned elements stays in the nav.
Put the nav element in the header, and style it position: fixed.
header {
position: fixed;
}
nav {
position: relative;
}
<header>
<nav>
<ul>
<li>Example</li>
<li>Example</li>
<li>Example</li>
<li>Example</li>
</ul>
<div class="absolute-div">
</div>
</nav>
</header>
This is a rather simple solution, when changing the position from relative to fixed, create and set a width style equal to 100%.
#cabeçalho {
position: fixed;
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
height: 110px;
}
It is possible to use flexbox layout. If it is used, then it will be simple to make columns to be set like row. And then there will be no need to use absolute positioning. In addition, your unordered list can be responsive, if we use flexbox layout. So the code would look like this:
.navbar {
position: fixed;
top: 0;
left: 0;
width: 100%;
}
.container {
display: flex;
flex-direction: row;
background-color: rgba(0, 0, 0, 0.6);
height: 110px;
}
.left {
flex-basis: 50%;
}
header h1 {
margin: 3px;
color: white;
font-size: 55px;
font-family: Avantgarde, TeX Gyre Adventor, URW Gothic L, Georgia, sans-serif;
}
header p {
color: white;
font-size: 25px;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
margin: 0px;
padding: 0px 0px 0px 95px;
}
.right {
flex: 1;
align-self: center;
}
li {
display: inline;
border: 1px solid white;
font-size: 15px;
padding: 10px;
margin: 5px;
color: white
}
.horizontal-list {
display: flex;
flex-flow: row wrap;
}
.list-item {
border: 1px solid white;
font-size: 15px;
padding: 10px;
margin: 5px;
color: white;
}
.order-1 {
order: 1;
}
.order-2 {
order: 2;
}
.order-3 {
order: 3;
}
.order-4 {
order: 4;
}
<div class="navbar">
<div class="container">
<div class="left">
<header>
<h1>Joana Bonvalot</h1>
<p>Artista - Pintora Clássica<p>
</header>
</div>
<div class="right">
<div class="horizontal-list">
<div class="list-item order-1">
Página Inicial
</div>
<div class="list-item order-2">
Galeria
</div>
<div class="list-item order-3">
Encomendas
</div>
<div class="list-item order-4">Contactos</div>
</div>
</div>
</div>
</div>

How can I keep all my navbar icons in one row when viewing from a mobile device in React?

I am making a pretty simple bottomnav for a project I am working on, and I am having difficulty with the view in mobile mode. From standard desktop, I have a pretty simple, bottomnav with 4 icons, however when I inspect the page in mobile view, it only shows you either the first, or the first and 2nd icon. all of my styling for this component is:
/* Place the navbar at the bottom of the page, and make it stick */
.navbar {
background-color: rgb(75, 90, 72);
overflow: hidden;
position: absolute;
bottom: 0;
min-width:800px;
height:64px;
/* width: 100%; */
}
.navCont {
text-align: center;
position: fixed;
bottom: 0;
width: 100%;
}
.navButton {
margin-left:10vh;
margin-right:10vh;
min-width:10px;
}
.navButtonLeft {
margin-left:10vh;
margin-right:10vh;
min-width:10px;
}
/* Style the links inside the navigation bar */
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
.navbar a:hover {
background-color: #ddd;
color: black;
}
/* Add a color to the active/current link */
.navbar a.active {
background-color: #4CAF50;
color: white;
}
img {
width:32px;
height: auto;
float:left;
margin-bottom: 20px;
}
#media screen and (max-width: 100px) {
.navbar {
display: inline-block;
height:64px;
}
.navCont {
display: flex;
align-content: space-between;
}
.navButton,
.navButtonLeft {
padding: none;
display: inline-block;
}
img {
display: inline-block;
}
}
Any advice or tips would be greatly appreciated!
edit: Here is the component i am working with.
import React from "react";
import home from "./home.png"
import post from "./post.png"
import profile from "./profile.png"
import search from "./search.png"
import "./Footer.css";
class Footer extends React.Component {
render() {
return (
<div class="navCont">
<div class="navbar">
<img src={home} alt="home icon"/>
<img src={profile} alt="home icon"/>
<img src={post} style={{width:"44px", height: "auto"}} alt="home icon"/>
<img src={search} style={{width:"44px", height: "auto"}} alt="home icon"/>
</div>
</div>
);
}
}
export default Footer;
I've revamped your css to use flexbox for laying out the icons in a row; got rid of all the floats and some other rules that seemed unnecessary. I'm not sure this does exactly what you're trying to do (since I don't know exactly what you're trying to do) but I think this is at least a better starting point.
.navCont {
position: fixed;
left: 0;
right: 0;
bottom: 0;
width: 100%;
background-color: rgb(75, 90, 72);
}
.navbar {
height: 64px;
display: flex;
justify-content: center;
}
/* Style the links inside the navigation bar */
.navbar > * {
flex: 0 0 auto;
padding: 14px 16px;
}
/* Change the color of links on hover */
.navbar a:hover {
background-color: #ddd;
color: black;
}
img {
width: 32px;
max-width: 100%;
height: auto;
}
<div class="navCont">
<div class="navbar">
<a href="/" class="navButton">
<img src="https://via.placeholder.com/64x64.png/fff/000/?text=A" />
</a>
<a href="Profile" class="navButton">
<img src="https://via.placeholder.com/64x64.png/fff/000?text=B" />
</a>
<a href="Post" class="navButton">
<img src="https://via.placeholder.com/64x64.png/fff/000?text=C" />
</a>
<a href="Search" class="navButton">
<img src="https://via.placeholder.com/64x64.png/fff/000?text=D" />
</a>
</div>
</div>

Strange inheriting from "a" element in "figure" to "p" element

I have a really weird bug about inheriting in css. p element that is not inside "a" elements block, inheriting "a" element's properties and turning an "a" element strangely.
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
#import url("https://fonts.googleapis.com/css?family=Lato|Roboto");
body {
margin: 0;
}
#navbar {
min-height: 90px;
position: fixed;
top: 0;
left: 0;
right: 0;
display: flex;
justify-content: flex-end;
align-items: center;
background: #303841;
}
#navbar a {
padding: 0 6vw;
text-decoration: none;
font: bold calc(20px + 1vw) "Lato";
color: #f6c90e;
letter-spacing: 2px;
text-shadow: 0 2px 0 black;
}
.container #welcome-section {
background: #303841;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.container #welcome-section header {
font-size: calc(20px + 2vw);
font-weight: bold;
font-family: 'Lato';
color: #f6c90e;
letter-spacing: 4px;
text-shadow: 0 2px 0 black;
text-align: center;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.container #welcome-section header p {
margin-top: 0;
color: #eeeeee;
}
.container #welcome-section header h1 {
margin-bottom: 10px;
}
.container #projects {
min-height: 100vh;
display: flex;
align-items: baseline;
justify-content: space-evenly;
flex-wrap: wrap;
background: #3a4750;
}
.container #projects h2 {
flex-basis: 100%;
text-align: center;
font-size: calc(20px + 3vw);
font-weight: bold;
font-family: 'Lato';
color: #eeeeee;
text-decoration: underline;
text-shadow: 0 2px 0 black;
}
.container #projects figure {
width: 35vw;
}
.container #projects figure img {
display: block;
max-width: 100%;
border-radius: 2%;
}
.container #projects figure a {
text-decoration: none;
display: block;
}
.container #projects figure figcaption {
text-align: center;
text-shadow: 0 2px 0 black;
font: bold calc(15px + 1vw) "Roboto";
color: #f6c90e;
}
#media (max-width: 768px) {
#navbar {
justify-content: space-between;
}
#projects > * {
flex-basis: 100%;
padding-bottom: 10px;
}
#projects a {
width: 75%;
margin: 0 auto;
}
}
#media (max-width: 768px) and (max-width: 576px) {
#navbar {
flex-direction: column;
justify-content: space-evenly;
align-items: center;
}
}
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!-- Navigation bar -->
<nav id="navbar">
About
Work
Contact
</nav>
<!-- Main content -->
<main class="container">
<section id="welcome-section">
<header>
<h1>Anıl Emek Türkeli</h1>
<p>Frontend Developer</p>
</header>
</section>
<section id="projects">
<h2>All Works I've Done So Far </h2>
<figure class="project-tile">
<img src="https://cdn1.imggmi.com/uploads/2019/3/12/f3614255ab87606e66bf5d449e194599-full.png"
<figcaption>Sass Technical Documentation Page</figcaption>
</figure>
<figure class="project-tile">
<img src="https://cdn1.imggmi.com/uploads/2019/3/12/99066cf68f33649bc17562c4925c3afa-full.png"
<figcaption>Repedo Landing Page</figcaption>
</figure>
<figure class="project-tile">
<img src="https://cdn1.imggmi.com/uploads/2019/3/12/626217cf51607a559f6a47fad499f355-full.png"
<figcaption>Repedo Survey Form</figcaption>
</figure>
<figure class="project-tile">
<img src="https://cdn1.imggmi.com/uploads/2019/3/12/1dbdcffbefc68964500597ec04e48e05-full.png"
<figcaption>Mustafa Kemal Atatürk's Tribute Page</figcaption>
</figure>
</section>
<section id="contact">
<p>Deneme</p>
</section>
</main>
https://codepen.io/anilemek/pen/PLjpQm
Can anybody explain why this issue occured?
Thank you.
If it is about the <p> with textDeneme at the bottom of the site, the issue is in the img tags before. You have to close them. So eg,<img src="https://cdn1.imggmi.com/uploads/2019/3/12/626217cf51607a559f6a47fad499f355-full.png"/>

Flexbox: while a group of items is at the very center of the page, put at single item at the bottom

I have used Bootstrap 4 and some custom CSS to make a hero section with all its items but one centered horizontally and vertically.
The exception is one item I want to align at the bottom of the page and still keep it centered horizontally.
html,
body {
padding: 0;
margin: 0;
height: 100%;
}
.page-wrapper {
min-height: 100%;
}
a.inherit {
color: inherit;
}
a.nounderline, a.nounderlie:hover {
text-decoration: none;
}
.page-wrapper {
min-height: 100%;
}
.hero {
height: 100vh;
overflow-y: hidden;
padding-top: 3rem;
padding-bottom: 3rem;
justify-content: center;
align-items: center;
}
.hero img {
width: 100%;
}
.hero.type-text h1 {
color: #000;
}
.hero.hero-short {
max-height: 768px;
}
section.type-text h3 {
font-weight: bold;
font-size: 2rem;
margin-bottom: 0;
}
section.type-text h4 {
font-size: 14px;
font-weight: bold;
margin-bottom: 0;
margin-top: 1.5rem;
}
section.type-text p {
font-weight: 500;
}
.allcases {
text-align: center;
font-weight: 700;
margin-top: auto;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="page-wrapper">
<section class="container d-flex hero type-text">
<div>
<h4 class="text-center m-0">Next item</h4>
<h1 class="display-1 text-center">
<a class="inherit nounderlie" href="#">Lorem</a>
</h1>
</div>
<p class="allcases">
<a class="inherit" href="#">See all items</a>
</p>
</section>
</div>
"See all items" does stay to the bottom (thanks to margin-top: auto), but it is not centered. Changing the flex-direction from row to column messes the whole layout so it is not the way to go.
What is viable solution?
You should be using flex-direction: column for this. This is an ideal use-case for it. Using row layout to achieve what you want, i.e. have the items horizontally centered is not viable. You'd be better off not using flex at all, and using margins instead. If you really wish to use flex-direction: row then the only solution I can think of is either to use position: absolute or a negative margin. Wouldn't recommend it though, since what you want can so easily be accomplished just by using flex-direction: column.
Here is the result I achieved just by changing 2 properties.
Update styling to
// Only added flex-direction: column to this
.hero {
height: 100vh;
overflow-y: hidden;
padding-top: 3rem;
padding-bottom: 3rem;
justify-content: center;
align-items: center;
flex-direction: column;
}
// This is to target the first div, i.e. the div that contains next item and Lorem, since the div doesn't have a class.
.hero > div {
margin-top: auto;
}
The answer is rather simple. Change the flex-flow of your container to column.
flex-flow:column;
Now you have two flex-items: The div, containing your Title and the other links and the footer-p. The first trick is to make your div grow, while the p-tag stays the same. So assign
flex: 1 auto;
to your div and
flex: 0 auto;
to your p-tag.
After doing so you have to add
display: flex;
justify-content: center;
flex-flow: column;
to your div, too. Making it a flex-box itself.
Your p-tag doesnt require more attention, you can also remove the unnecessary margins.
This should do the trick.
You need to allow wrapping and set a width to the div suppose to stand at top
to allow wrapping, use a class
<section class="container d-flex hero type-text flex-wrap">
for the di, you can do :
.hero>div {
width:100%;
}
html,
body {
padding: 0;
margin: 0;
height: 100%;
}
.page-wrapper {
min-height: 100%;
}
a.inherit {
color: inherit;
}
a.nounderline, a.nounderlie:hover {
text-decoration: none;
}
.hero {
height: 100vh;
overflow-y: hidden;
padding-top: 3rem;
padding-bottom: 3rem;
justify-content: center;
align-items: center;
}
.hero>div {
width:100%;
}
.hero img {
width: 100%;
}
.hero.type-text h1 {
color: #000;
}
.hero.hero-short {
max-height: 768px;
}
section.type-text h3 {
font-weight: bold;
font-size: 2rem;
margin-bottom: 0;
}
section.type-text h4 {
font-size: 14px;
font-weight: bold;
margin-bottom: 0;
margin-top: 1.5rem;
}
section.type-text p {
font-weight: 500;
}
.allcases {
text-align: center;
font-weight: 700;
margin: auto auto 0 auto;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="page-wrapper">
<section class="container d-flex hero type-text flex-wrap">
<div>
<h4 class="text-center m-0">Next item</h4>
<h1 class="display-1 text-center">
<a class="inherit nounderlie" href="#">Lorem</a>
</h1>
</div>
<p class="allcases">
<a class="inherit" href="#">See all items</a>
</p>
</section>
</div>
Another option is to use the flex-column class
html,
body {
padding: 0;
margin: 0;
height: 100%;
}
.page-wrapper {
min-height: 100%;
}
a.inherit {
color: inherit;
}
a.nounderline, a.nounderlie:hover {
text-decoration: none;
}
.hero {
height: 100vh;
overflow-y: hidden;
padding-top: 3rem;
padding-bottom: 3rem;
justify-content: center;
align-items: center;
}
.hero img {
width: 100%;
}
.hero.type-text h1 {
color: #000;
}
.hero.hero-short {
max-height: 768px;
}
section.type-text h3 {
font-weight: bold;
font-size: 2rem;
margin-bottom: 0;
}
section.type-text h4 {
font-size: 14px;
font-weight: bold;
margin-bottom: 0;
margin-top: 1.5rem;
}
section.type-text p {
font-weight: 500;
}
.allcases {
text-align: center;
font-weight: 700;
margin: auto auto 0 auto;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="page-wrapper">
<section class="container d-flex flex-column hero type-text ">
<div>
<h4 class="text-center m-0">Next item</h4>
<h1 class="display-1 text-center">
<a class="inherit nounderlie" href="#">Lorem</a>
</h1>
</div>
<p class="allcases">
<a class="inherit" href="#">See all items</a>
</p>
</section>
</div>
in both example, margin of allcases is reset to :
margin: auto auto 0 auto;
to stick it at bottom of container, no matter the flex-direction.

How do I evenly distribute a group of spans across a div?

I have an aside on the side of my webpage that contains span blocks that contain tags for blog posts. Right now, they're set up with display: inline-table that put multiple on each line and then go to the next line as overflow.
If possible (and JavaScript is okay, but CSS is preferred), how can I get these spans to take up the entire width inside of the div so I don't have the "rough edge" to the right? I'd like to either increase the margins between the span blocks or I'd be okay with increasing the width of the span as well.
Here's the code I currently have:
body {
background-color: #333;
color: #333332;
}
aside {
background-color: white;
width: 300px;
height: 300px;
margin: auto;
}
h2 {
margin: 24px;
padding-top: 24px;
}
.tag-wrapper {
padding: 0px 24px;
}
span {
display: inline-table;
text-transform: uppercase;
background-color: #F77C2F;
margin: 4px 2px;
padding: 8px;
}
<div class="container">
<aside>
<h2>Tags</h2>
<div class="tag-wrapper">
<span>finance</span>
<span>if</span>
<span>pv</span>
<span>pivot tables</span>
<span>vba</span>
<span>test</span>
<span>test</span>
<span>test</span>
</div>
</aside>
</div>
A little flexbox magic will get the job done:
body {
background-color: #333;
color: #333332;
}
aside {
background-color: white;
width: 300px;
height: 300px;
margin: auto;
}
h2 {
margin: 24px;
padding-top: 24px;
}
.tag-wrapper {
padding: 0px 24px;
display: flex;
flex-flow: row wrap;
align-content: stretch;
}
span {
flex: 1 0 auto;
text-transform: uppercase;
background-color: #F77C2F;
margin: 4px 2px;
padding: 8px;
}
<div class="container">
<aside>
<h2>Tags</h2>
<div class="tag-wrapper">
<span>finance</span>
<span>if</span>
<span>pv</span>
<span>pivot tables</span>
<span>vba</span>
<span>test</span>
<span>test</span>
<span>test</span>
</div>
</aside>
</div>
The properties used are:
display: flex: this sets the display type of the container to flex (aka flexbox)
flex-flow: row wrap: makes items order in a row, and wrap as required.
align-content: stretch: makes items stretch to fill the flex direction (row).
flex 1 0 auto: makes the items "growable" (1), but not "shrinkable" (0), and use self base width (auto) before distributing leftover space.
Is this what you are talking about? If so, just change the display of the span to block instead of inline-block.
body {
background-color: #333;
color: #333332;
}
aside {
background-color: white;
width: 300px;
height: 300px;
margin: auto;
}
h2 {
margin: 24px;
padding-top: 24px;
}
.tag-wrapper {
padding: 0px 24px;
}
span {
display: block;
text-transform: uppercase;
background-color: #F77C2F;
margin: 4px 2px;
padding: 8px;
}
<div class="container">
<aside>
<h2>Tags</h2>
<div class="tag-wrapper">
<span>finance</span>
<span>if</span>
<span>pv</span>
<span>pivot tables</span>
<span>vba</span>
<span>test</span>
<span>test</span>
<span>test</span>
</div>
</aside>
</div>

Resources