I'm trying to achieve the following:
The problem I still have is the line before the first element and after the last element should be hidden.
The second issue is that the numbers are not vertically centered even when I use a flexbox with align-items and justify-content, if I zoom the picture a bit you can see that there is some difference:
The difference without zooming is about 2px~3px.
This is what I tried:
.container {
margin-top: 60px;
position: relative;
}
ol {
counter-reset: section;
list-style-type: none;
border-top: 1px solid #D9DEEA;
padding: 0;
margin: 36px 0 210px 0;
}
li {
float: left;
width: 20%;
padding-top: calc(58px / 2);
position: relative;
font-family: 'Antonio', sans-serif;
font-weight: 700;
display: flex;
flex-direction: column;
align-items: center;
}
li::before {
counter-increment: section;
content: counters(section, ".") " ";
width: 56px;
height: 56px;
background: #fff;
border: 2px dashed #D9DEEA;
border-radius: 50%;
box-shadow: 0 0 0 6px #fff;
position: absolute;
top: -30.5px;
left: calc(50% - 30px);
display: flex;
justify-content: center;
align-items: center;
line-height: 34px;
font-size: 24px;
}
.title {
margin: 6px 0;
line-height: 30px;
letter-spacing: -0.77px;
font-size: 25px;
display: block;
text-align: center;
}
.illustration {
display: block;
width: 165px;
height: 140px;
display: flex;
align-items: center;
justify-content: center;
background-color: #E6E9F0;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Antonio:wght#300;400;700&family=Roboto:wght#300;400;500;700&display=swap" rel="stylesheet">
<section class="container">
<ol>
<li>
<span class="title">Lorem.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum dolor.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem ipsum.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum dolor.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
</ol>
</section>
I finally found a solution for the first issue.
The idea is to use a pseudo-element for ol that will act as a border with limited width.
.container {
margin-top: 60px;
position: relative;
}
ol {
counter-reset: section;
list-style-type: none;
padding: 0;
margin: 36px 0 0 0;
}
ol::before {
content: "";
display: block;
background: #D9DEEA;
position: absolute;
top: 0;
left: 10%;
height: 1px;
width: 80%;
}
li {
float: left;
width: 20%;
padding-top: calc(58px / 2);
position: relative;
font-family: 'Antonio', sans-serif;
font-weight: 700;
display: flex;
flex-direction: column;
align-items: center;
}
li::before {
counter-increment: section;
content: counters(section, ".") " ";
width: 56px;
height: 56px;
background: #fff;
border: 2px dashed #D9DEEA;
border-radius: 50%;
box-shadow: 0 0 0 6px #fff;
position: absolute;
top: -30.5px;
left: calc(50% - 30px);
display: flex;
justify-content: center;
align-items: center;
line-height: 34px;
font-size: 24px;
}
.title {
margin: 6px 0;
line-height: 30px;
letter-spacing: -0.77px;
font-size: 25px;
display: block;
text-align: center;
}
.illustration {
display: block;
width: 165px;
height: 140px;
display: flex;
align-items: center;
justify-content: center;
background-color: #E6E9F0;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Antonio:wght#300;400;700&family=Roboto:wght#300;400;500;700&display=swap" rel="stylesheet">
<section class="container">
<ol>
<li>
<span class="title">Lorem.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum dolor.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem ipsum.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum dolor.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
</ol>
</section>
I'm not sure how to fix your problem with the styling of the li::before element, but here is a solution for your timeline not extending past 1 or 5. Add a ::before element to the ol element.
Edit: Solution was sourced from Border length smaller than div width?
.container {
margin-top: 60px;
position: relative;
}
ol {
counter-reset: section;
list-style-type: none;
padding: 0;
margin: 36px 0 210px 0;
}
ol::before {
content: "";
height: 10px;
width: 90%;
position: absolute;
top: -10px;
left: 5%;
/* or 100px */
border-bottom: 1px solid magenta;
}
li {
float: left;
width: 20%;
padding-top: calc(58px / 2);
position: relative;
font-family: 'Antonio', sans-serif;
font-weight: 700;
display: flex;
flex-direction: column;
align-items: center;
}
li::before {
counter-increment: section;
content: counters(section, ".") " ";
width: 56px;
height: 56px;
background: #fff;
border: 2px dashed #D9DEEA;
border-radius: 50%;
box-shadow: 0 0 0 6px #fff;
position: absolute;
top: -30.5px;
left: calc(50% - 30px);
display: flex;
justify-content: center;
align-items: center;
line-height: 34px;
font-size: 24px;
}
.title {
margin: 6px 0;
line-height: 30px;
letter-spacing: -0.77px;
font-size: 25px;
display: block;
text-align: center;
}
.illustration {
display: block;
width: 165px;
height: 140px;
background: url("../Images/API_EDI/catalog-bg.png") no-repeat center center;
display: flex;
align-items: center;
justify-content: center;
background-color: #E6E9F0;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Antonio:wght#300;400;700&family=Roboto:wght#300;400;500;700&display=swap" rel="stylesheet">
<section class="container">
<ol>
<li>
<span class="title">Lorem.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum dolor.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem ipsum.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
<li>
<span class="title">Lorem, ipsum dolor.</span>
<span class="illustration">
<img src="" alt="">
</span>
</li>
</ol>
</section>
Related
How do I override CSS that makes divs stack on top of each other and run full-width, to instead make the divs run left to right?
Specifically, how do I modify mine, 3 x .notion-callout or a child, at the bottom of this card, which run left to right, to ensure that they run side-by-side each other?
The objective is to have the grey boxes be only about as wide as the icons contained within, rather than stretch full-width, starting from the left.
(1) One thing I have done is to apply visibility: hidden to some anchor text in those boxes (I'm not in a position to alter the mark-up, only the CSS and CSS overrides).
(2) I have also poured over many similar Stackoverflow threads.
(3) I have tried applying a range of display values, ie. inline, inline-block, but can't get the box width to constrain.
/*I believe this is the relevant CSS. There is also an ultimate parent class with `display: flex`.*/
.notion-root.full-width {
width: 100%;
}
.notion-root {
display: -webkit-flex;
display: -moz-box;
display: flex;
-webkit-flex-direction: column;
-moz-box-orient: vertical;
-moz-box-direction: normal;
flex-direction: column;
}
.notion-callout {
display: -webkit-flex;
display: -moz-box;
display: flex;
border-radius: 5px;
padding: 16px 16px 16px 12px;
margin-top: 2px;
margin-bottom: 4px;
border: 1px solid transparent;
}
.notion-callout {
position: relative !important;
}
.notion-callout__icon {
width: 1.8em;
line-height: 1.3em;
padding: 1.2px;
}
.notion-callout__content {
margin-left: 8px;
visibility: hidden;
}
.notion-semantic-string {
line-height: 1.5;
}
.notion-semantic-string {
line-height: 1.5;
}
.notion-semantic-string .link {
color: inherit;
text-decoration: none;
border-bottom: 1px solid var(--color-text-default-light);
opacity: .7;
-moz-transition: border-color .1s ease-in, opacity .1s ease-in;
transition: border-color .1s ease-in, opacity .1s ease-in;
}
.notion-callout a {
padding: 0 0 2px 50px !important;
align-items: center !important;
position: absolute !important;
display: flex !important;
border: none !important;
bottom: 0 !important;
right: 0 !important;
left: 0 !important;
top: 0 !important;
}
<article id="block-44da810a1ed446bf9bf9c9ce058b1702" class="notion-root full-width">
<h3 id="block-d55821810b9b4f199d3befb349f1b29e" class="notion-heading">
<span class="notion-heading__anchor" id="d55821810b9b4f199d3befb349f1b29e"></span
><span class="notion-semantic-string"><span>Multiverse analyst</span></span>
</h3>
<div id="block-b26901cad4bf4def825f154ebe30e0c7" class="notion-text">
<p class="notion-text__content">
<span class="notion-semantic-string"><span
>Lorem ipsum dolor ex magna. Interdum malesuada fames ac ante ipsum
amet et faucibus. Pellentesque et venenatis.</span
></span
>
</p>
</div>
<div id="block-d6140ff909d34f99833ae73922f1a2e1" class="notion-text">
<p class="notion-text__content">
<span class="notion-semantic-string"></span>
</p>
</div>
<div id="block-974b3353883a4998b6ca59807914ceb9" class="notion-callout bg-gray-light border">
<div class="notion-callout__icon">
<div style="
overflow: hidden;
box-sizing: border-box;
display: inline-block;
position: relative;
width: 24px;
height: 24px;
">
<img alt="icon" src="/_next/image?url=https%3A%2F%2Fapi.super.so%2Fasset%2Fdemo.notionware.shop%2F755f0732-a73d-4410-b418-ff2f269a66b0.png&w=640&q=100" decoding="async" class="notion-icon" style="
visibility: visible;
position: absolute;
inset: 0px;
box-sizing: border-box;
padding: 0px;
border: medium none;
margin: auto;
display: block;
width: 0px;
height: 0px;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
" srcset="
/_next/image?url=https%3A%2F%2Fapi.super.so%2Fasset%2Fdemo.notionware.shop%2F755f0732-a73d-4410-b418-ff2f269a66b0.png&w=640&q=100 1x
" />
</div>
</div>
<p class="notion-callout__content">
<span class="notion-semantic-string"><span
><a
href="http://www.notionhq.com"
class="notion-link link"
target="_blank"
rel="noopener noreferrer"
>PollardsProgress</a
></span
></span
>
</p>
</div>
<div
id="block-99956269608948c2a97ac5603368a892"
class="notion-callout bg-gray-light border"
>
<div class="notion-callout__icon">
<div
style="
overflow: hidden;
box-sizing: border-box;
display: inline-block;
position: relative;
width: 24px;
height: 24px;
"
>
<img
alt="icon"
src="/_next/image?url=https%3A%2F%2Fapi.super.so%2Fasset%2Fdemo.notionware.shop%2F3f605f41-8b78-4e86-b128-69e547cb34a3.png&w=640&q=100"
decoding="async"
class="notion-icon"
style="
visibility: visible;
position: absolute;
inset: 0px;
box-sizing: border-box;
padding: 0px;
border: medium none;
margin: auto;
display: block;
width: 0px;
height: 0px;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
"
srcset="
/_next/image?url=https%3A%2F%2Fapi.super.so%2Fasset%2Fdemo.notionware.shop%2F3f605f41-8b78-4e86-b128-69e547cb34a3.png&w=640&q=100 1x
"
/>
</div>
</div>
<p class="notion-callout__content">
<span class="notion-semantic-string"
><span
><a
href="http://www.notionhq.com"
class="notion-link link"
target="_blank"
rel="noopener noreferrer"
>CaycePollard</a
></span
></span
>
</p>
</div>
<div
id="block-22e0c2a2e50a409ba6606503372bfa41"
class="notion-callout bg-gray-light border"
>
<div class="notion-callout__icon">
<div
style="
overflow: hidden;
box-sizing: border-box;
display: inline-block;
position: relative;
width: 24px;
height: 24px;
"
>
<img
alt="icon"
src="/_next/image?url=https%3A%2F%2Fapi.super.so%2Fasset%2Fdemo.notionware.shop%2Fee17734e-3566-4b32-b1e1-952dabc764bf.png&w=640&q=100"
decoding="async"
class="notion-icon"
style="
visibility: visible;
position: absolute;
inset: 0px;
box-sizing: border-box;
padding: 0px;
border: medium none;
margin: auto;
display: block;
width: 0px;
height: 0px;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
"
srcset="
/_next/image?url=https%3A%2F%2Fapi.super.so%2Fasset%2Fdemo.notionware.shop%2Fee17734e-3566-4b32-b1e1-952dabc764bf.png&w=640&q=100 1x
"
/>
</div>
</div>
<p class="notion-callout__content">
<span class="notion-semantic-string"
><span
><a
href="http://www.medium.com"
class="notion-link link"
target="_blank"
rel="noopener noreferrer"
>Cayce's Musings</a
></span
></span
>
</p>
</div>
<div id="block-06ddcfa82b06404c87c3329408b97d7d" class="notion-text">
<p class="notion-text__content">
<span class="notion-semantic-string"></span>
</p>
</div>
</article>
As written above you can use CSS flex layout or you can also build a CSS grid layout.
/*I believe this is the relevant CSS. There is also an ultimate parent class with `display: flex`.*/
.notion-root{
display: grid;
grid-gap: 10px;
grid-template-columns: auto auto auto;
}
.notion-heading{
grid-column: 1 /span 3;
grid-row: 1;
}
.notion-text{
grid-column: 1 /span 3;
grid-row: 2;
}
.notion-callout {
grid-row: 3;
border-radius: 5px;
padding: 16px 16px 16px 12px;
margin-top: 2px;
margin-bottom: 4px;
border: 1px solid red;
}
.notion-callout__icon {
width: 1.8em;
line-height: 1.3em;
padding: 1.2px;
}
.notion-callout__content {
margin-left: 8px;
visibility: hidden;
}
.notion-semantic-string {
line-height: 1.5;
}
.notion-semantic-string {
line-height: 1.5;
}
.notion-semantic-string .link {
color: inherit;
text-decoration: none;
border-bottom: 1px solid var(--color-text-default-light);
opacity: .7;
-moz-transition: border-color .1s ease-in, opacity .1s ease-in;
transition: border-color .1s ease-in, opacity .1s ease-in;
}
.notion-callout a {
padding: 0 0 2px 50px !important;
align-items: center !important;
position: absolute !important;
display: flex !important;
border: none !important;
bottom: 0 !important;
right: 0 !important;
left: 0 !important;
top: 0 !important;
}
<article id="block-44da810a1ed446bf9bf9c9ce058b1702" class="notion-root full-width">
<h3 id="block-d55821810b9b4f199d3befb349f1b29e" class="notion-heading">
<span class="notion-heading__anchor" id="d55821810b9b4f199d3befb349f1b29e"></span
><span class="notion-semantic-string"><span>Multiverse analyst</span></span>
</h3>
<div id="block-b26901cad4bf4def825f154ebe30e0c7" class="notion-text">
<p class="notion-text__content">
<span class="notion-semantic-string"><span
>Lorem ipsum dolor ex magna. Interdum malesuada fames ac ante ipsum
amet et faucibus. Pellentesque et venenatis.</span
></span
>
</p>
</div>
<div id="block-d6140ff909d34f99833ae73922f1a2e1" class="notion-text">
<p class="notion-text__content">
<span class="notion-semantic-string"></span>
</p>
</div>
<div id="block-974b3353883a4998b6ca59807914ceb9" class="notion-callout bg-gray-light border">
<div class="notion-callout__icon">
<div style="
overflow: hidden;
box-sizing: border-box;
display: inline-block;
position: relative;
width: 24px;
height: 24px;
">
<img alt="icon" src="https://picsum.photos/200" decoding="async" class="notion-icon" style="
visibility: visible;
position: absolute;
inset: 0px;
box-sizing: border-box;
padding: 0px;
border: medium none;
margin: auto;
display: block;
width: 0px;
height: 0px;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
" srcset="
https://picsum.photos/200
" />
</div>
</div>
<p class="notion-callout__content">
<span class="notion-semantic-string"><span
><a
href="http://www.notionhq.com"
class="notion-link link"
target="_blank"
rel="noopener noreferrer"
>PollardsProgress</a
></span
></span
>
</p>
</div>
<div
id="block-99956269608948c2a97ac5603368a892"
class="notion-callout bg-gray-light border"
>
<div class="notion-callout__icon">
<div
style="
overflow: hidden;
box-sizing: border-box;
display: inline-block;
position: relative;
width: 24px;
height: 24px;
"
>
<img
alt="icon"
src="https://picsum.photos/200"
decoding="async"
class="notion-icon"
style="
visibility: visible;
position: absolute;
inset: 0px;
box-sizing: border-box;
padding: 0px;
border: medium none;
margin: auto;
display: block;
width: 0px;
height: 0px;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
"
srcset="
https://picsum.photos/200
"
/>
</div>
</div>
<p class="notion-callout__content">
<span class="notion-semantic-string"
><span
><a
href="http://www.notionhq.com"
class="notion-link link"
target="_blank"
rel="noopener noreferrer"
>CaycePollard</a
></span
></span
>
</p>
</div>
<div
id="block-22e0c2a2e50a409ba6606503372bfa41"
class="notion-callout bg-gray-light border"
>
<div class="notion-callout__icon">
<div
style="
overflow: hidden;
box-sizing: border-box;
display: inline-block;
position: relative;
width: 24px;
height: 24px;
"
>
<img
alt="icon"
src="https://picsum.photos/200"
decoding="async"
class="notion-icon"
style="
visibility: visible;
position: absolute;
inset: 0px;
box-sizing: border-box;
padding: 0px;
border: medium none;
margin: auto;
display: block;
width: 0px;
height: 0px;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
"
srcset="
https://picsum.photos/200
"
/>
</div>
</div>
<p class="notion-callout__content">
<span class="notion-semantic-string"
><span
><a
href="http://www.medium.com"
class="notion-link link"
target="_blank"
rel="noopener noreferrer"
>Cayce's Musings</a
></span
></span
>
</p>
</div>
<div id="block-06ddcfa82b06404c87c3329408b97d7d" class="notion-text">
<p class="notion-text__content">
<span class="notion-semantic-string"></span>
</p>
</div>
</article>
Sorry for the simplicity of this question. This doesnt work by any way, I dont know what else to do.
This image shouldnt be selected? I've tried lot of ways to select it but its not being selected.
I may be making a fool mistake.
HTML
<div class="social-media__banner">
<ul>
<li>
<a href="">
<img id="icon-test" src="images/github.svg" alt="github">
</a>
</li>
<li>
<a href="">
</a>
</li>
<li>
<a href="">
</a>
</li>
</ul>
</div>
CSS
.social-media__banner {
margin-top: 20px;
position: absolute;
top:500px;
left: 0;
width: 100%;
height: 200px;
ul{
left: 0rem;
width: 30px;
display: flex;
padding: 0;
li{
margin: 0 10px;
list-style: none;
font-size: 20px;
padding: 20px 20px;
color: white;
a{
position: relative;
display: block;
width: 50px;
height: 50px;
background-color: white;
color: black;
text-align: center;
border-radius: 50%;
overflow: hidden;
}
}
}
}
#icon-test{
height: 24px;
margin-top: 11px;
}
*I've checked on the inspector tool and it does not even select.
Thanks
If not for the cleanliness alone, why nest all of those selectors? Stick with the basics and you won't go wrong. You are saving yourself having to write .social-media__banner only a few times in your code.
.social-media__banner {
margin-top: 20px;
position: absolute;
top:500px;
left: 0;
width: 100%;
height: 200px;
}
.social-media__banner ul{
left: 0rem;
width: 30px;
display: flex;
padding: 0;
}
.social-media__banner li{
margin: 0 10px;
list-style: none;
font-size: 20px;
padding: 20px 20px;
color: white;
}
.social-media__banner a{
position: relative;
display: block;
width: 50px;
height: 50px;
background-color: white;
color: black;
text-align: center;
border-radius: 50%;
overflow: hidden;
}
#icon-test{
height: 24px;
margin-top: 11px;
}
<div class="social-media__banner">
<ul>
<li>
<a href="">
<img id="icon-test" src="https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg" alt="github">
</a>
</li>
<li>
<a href="">
</a>
</li>
<li>
<a href="">
</a>
</li>
</ul>
</div>
I'm looking to get the dots aligned, fixed, and should not move. This is what I need it to look like:
This is what I have so far below. As you can see if there are double digits, the dot moves.
This is what I'm rendering on the DOM. As you can see I have separated all three items into their own span.
<div className="Legend-Component col-3" align="center">
{legendData.map((item, index) => (
<ul key={index}>
<li>
<span className="Legend-Name" onClick={() => this.handleClick(item.assetManagerId)}>
{item.name}
</span>
<span className={`${item.className[index]}`}></span>
<span className="Legend-Total">{item.total}</span>
</li>
</ul>
))}
</div>
My CSS:
.Legend-Component ul {
list-style-type: none;
font-size: 12px;
text-align: right;
margin: auto;
}
.Legend-Name{
color: #006192;
cursor: pointer;
}
.Legend-Total {
font-weight: bold;
}
.navy {
display: inline-block;
width: 13px;
height: 13px;
background-color: #001f3f;
border-radius: 50%;
border: 1px solid grey;
}
.blue {
display: inline-block;
height: 13px;
width: 13px;
background-color: #0074D9;
border-radius: 50%;
border: 1px solid grey;
margin: 0 2px;
}
.aqua {
display: inline-block;
height: 13px;
width: 13px;
background-color: #7FDBFF;
border-radius: 50%;
border: 1px solid grey;
margin: 0 2px;
}
.teal {
display: inline-block;
height: 13px;
width: 13px;
background-color: #39CCCC;
border-radius: 50%;
border: 1px solid grey;
margin: 0 2px;
}
Make each list item a flex item. Allow the left and right elements to fill the available space with flex: 1.
This will keep the circles centred.
ul {
list-style: none;
padding: 0;
}
.circle {
display: inline-block;
height: 13px;
width: 13px;
border-radius: 50%;
border: 1px solid grey;
margin: 0 2px;
}
.blue {
background-color: #0074D9;
}
/* The important bits... */
.legend-item {
display: flex;
}
.legend-name {
flex: 1;
text-align: right;
}
.legend-total {
flex: 1;
}
<div className="Legend-Component col-3">
<ul key={index}>
<li class="legend-item">
<span class="legend-name">
Legend Name
</span>
<span class="circle blue"></span>
<span class="legend-total">00</span>
</li>
<li class="legend-item">
<span class="legend-name">
Legend Name
</span>
<span class="circle blue"></span>
<span class="legend-total">000</span>
</li>
<li class="legend-item">
<span class="legend-name">
Legend Name Long
</span>
<span class="circle blue"></span>
<span class="legend-total">0</span>
</li>
</ul>
</div>
If you need to align the circles off-centre, you may have to play with the flex-basis:
ul {
list-style: none;
padding: 0;
}
.circle {
display: inline-block;
height: 13px;
width: 13px;
border-radius: 50%;
border: 1px solid grey;
margin: 0 2px;
}
.blue {
background-color: #0074D9;
}
/* The important bits... */
.legend-item {
display: flex;
}
.legend-name {
flex: 1;
flex-basis: 100%;
text-align: right;
}
.legend-total {
flex: 1;
flex-basis: 50px;
}
<div className="Legend-Component col-3">
<ul key={index}>
<li class="legend-item">
<span class="legend-name">
Legend Name
</span>
<span class="circle blue"></span>
<span class="legend-total">00</span>
</li>
<li class="legend-item">
<span class="legend-name">
Legend Name
</span>
<span class="circle blue"></span>
<span class="legend-total">000</span>
</li>
<li class="legend-item">
<span class="legend-name">
Legend Name Long
</span>
<span class="circle blue"></span>
<span class="legend-total">0</span>
</li>
</ul>
</div>
We have a group of avatars held in a container, I want to add a plus symbol at the end of the group so that the user can select to add more people,
When I add it the new component is forced down. I can;t see how to stop this happening.
working code pen
https://codepen.io/jachno/pen/zYOLbyd
.avatar {
color: #fff;
background-color: #adb5bd;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 1rem;
border-radius: 50%;
height: 48px;
width: 48px;
}
.avatar img {
width: 100%;
border-radius: 50%;
}
.avatar span {
width: 100%;
border-radius: 50%;
}
.avatar+.avatar-content {
display: inline-block;
margin-left: .75rem;
}
.avatar-lg {
width: 58px;
height: 58px;
font-size: 0.875rem;
}
.avatar-sm {
width: 36px;
height: 36px;
font-size: 0.875rem;
}
.avatar-group .avatar {
position: relative;
z-index: 2;
border: 2px solid #fff;
}
.avatar-group .avatar:hover {
z-index: 3;
}
.avatar-group .avatar+.avatar {
margin-left: -1rem;
}
<div style="padding:10px">
<div class="avatar-group">
<a href="#" class="avatar avatar-sm" data-toggle="tooltip" v-tooltip="'Ryan Tompson'" data-original-title="steve Hadid">
<img alt="Image placeholder" src="https://randomuser.me/api/portraits/women/68.jpg" class="rounded-circle">
</a>
<a href="#" class="avatar avatar-sm" data-toggle="tooltip" data-original-title="Romina Hadid" v-tooltip="'Romina Hadid'"> <img alt="Image placeholder" src="https://randomuser.me/api/portraits/women/48.jpg" class="rounded-circle">
</a>
<a href="#" class="avatar avatar-sm">
<div>
<i class="fa fa-plus"></i>
</div>
</a>
</div>
</div>
</div>
You have to assign .avatar-group{display:flex} in order to make it work
.avatar {
color: #fff;
background-color: #adb5bd;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 1rem;
border-radius: 50%;
height: 48px;
width: 48px;
}
.avatar img {
width: 100%;
border-radius: 50%;
}
.avatar span {
width: 100%;
border-radius: 50%;
}
.avatar+.avatar-content {
display: inline-block;
margin-left: .75rem;
}
.avatar-lg {
width: 58px;
height: 58px;
font-size: 0.875rem;
}
.avatar-sm {
width: 36px;
height: 36px;
font-size: 0.875rem;
}
.avatar-group {
display: flex;
flex-direction: row;
}
.avatar-group .avatar {
position: relative;
z-index: 2;
border: 2px solid #fff;
}
.avatar-group .avatar:hover {
z-index: 3;
}
.avatar-group .avatar+.avatar {
margin-left: -1rem;
}
<div style="padding:10px">
<div class="avatar-group">
<a href="#" class="avatar avatar-sm" data-toggle="tooltip" v-tooltip="'Ryan Tompson'" data-original-title="steve Hadid">
<img alt="Image placeholder" src="https://randomuser.me/api/portraits/women/68.jpg" class="rounded-circle">
</a>
<a href="#" class="avatar avatar-sm" data-toggle="tooltip" data-original-title="Romina Hadid" v-tooltip="'Romina Hadid'"> <img alt="Image placeholder" src="https://randomuser.me/api/portraits/women/48.jpg" class="rounded-circle">
</a>
<a href="#" class="avatar avatar-sm">
<div>
<i class="fa fa-plus"></i>
</div>
</a>
</div>
</div>
</div>
You have to add CSS vertical-align:top to tag a having class avatar-sm in order to make it work
.avatar {
color: #fff;
background-color: #adb5bd;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 1rem;
border-radius: 50%;
height: 48px;
width: 48px;
}
.avatar img {
width: 100%;
border-radius: 50%;
}
.avatar span {
width: 100%;
border-radius: 50%;
}
.avatar+.avatar-content {
display: inline-block;
margin-left: .75rem;
}
.avatar-lg {
width: 58px;
height: 58px;
font-size: 0.875rem;
}
.avatar-sm {
width: 36px;
height: 36px;
font-size: 0.875rem;
vertical-align: top;
}
.avatar-group {
display: flex;
flex-direction: row;
}
.avatar-group .avatar {
position: relative;
z-index: 2;
border: 2px solid #fff;
}
.avatar-group .avatar:hover {
z-index: 3;
}
.avatar-group .avatar+.avatar {
margin-left: -1rem;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div style="padding:10px">
<div class="avatar-group">
<a href="#" class="avatar avatar-sm" data-toggle="tooltip" v-tooltip="'Ryan Tompson'" data-original-title="steve Hadid">
<img alt="Image placeholder" src="https://randomuser.me/api/portraits/women/68.jpg" class="rounded-circle">
</a>
<a href="#" class="avatar avatar-sm" data-toggle="tooltip" data-original-title="Romina Hadid" v-tooltip="'Romina Hadid'"> <img alt="Image placeholder" src="https://randomuser.me/api/portraits/women/48.jpg" class="rounded-circle">
</a>
<a href="#" class="avatar avatar-sm">
<div>
<i class="fa fa-plus"></i>
</div>
</a>
</div>
</div>
</div>
Why text is not wrapping in IE10?
body{
background: url(http://i.imgur.com/ilgJJ1Q.gif);
margin: 0;
}
ul{
margin: 0;
padding: 0;
list-style: none;
display: flex;
height: 80px;
}
li{
display: flex;
}
ul a {
color: #fff;
display: flex;
-webkit-align-items: center;
align-items: center;
max-width: 240px;
padding: 12px 50px;
align-items: center;
text-transform: uppercase;
text-decoration: none;
}
li img{
border: 0;
margin-right: 10px;
}
li span span {
display: block;
height: 2px;
margin: 7px 0 -7px;
width: 25px;
}
li:last-child{
background: rgba(38, 46, 54, .6);
}
li:nth-child(2){ background: #a15796; }
li:nth-child(3){ background: #b48c4d; }
li:nth-child(4){ background: #3a7d7d; }
<ul class="top-level-tax">
<li>
<a href="#" >
<img src="http://i.imgur.com/SRVh4os.png">
<span>Lorem ipsum dolor<span style="background-color: #38729c;"></span></span>
</a>
</li>
<li>
<a href="#" >
<img src="http://i.imgur.com/rBM2CYr.png">
<span>consectetur adipisicing<span style="background-color: #a05995;"></span></span>
</a>
</li>
<li>
<a href="#" class="" >
<img src="http://i.imgur.com/9dFFuH5.png">
<span>Mollitia harum<span style="background-color: #b38c51;"></span></span>
</a>
</li>
<li>
<a href="#" >
<img src="http://i.imgur.com/7bQ73kd.png">
<span>veritatis ea ipsa<span style="background-color: #3d7d7d;"></span></span>
</a>
</li>
</ul>
https://jsfiddle.net/afelixj/79pybrh9/1/
Add max-width to the span
li span{
display: block;
max-width: 120px;
}
You need to add flex-wrap: wrap; on your <ul> to specify you want it to wrap its content.