background fontstyle black index number inside flex-col container
So what I'm trying to achieve is aligning an index number with lowered opacity into the center of a flex parent container.
This ain't working though properly.
Therefore I tried troubleshooting by adding , without any success though.
May you please consider helping with this one?
41 Replies
have you tried using grid?
with grid, this is stupid easy
or ::before or ::after with position absolute?
ah with stuff like spanning rows and columns?
yeah I use pseudo elements way to rarely give me a minute to try out both approaches. 😄
if you put
position: relative
and then you put position: absolute; top: 0; bottom: 0; left: 0; right: 0;
, it should worknot working with spanning into both directions twice
it usually works
thats what I done and its being positioned below, and line-height (respectively "leading" with :tailwind:), it improved slightly but isn't pitch perfect and too much experimental
did you put
line-height: 1
?yeah thats what I thought of as well. May you further explain other things to apply with grid solution? Im trying out now pseudo element stuff which is basically the same
in the pseudo-element
yup 😄 also 1px and stuff. tried out a lot
not pseudo, just kept it at span, trying out pseudo one now.
try the pseudo-element
a span is different, and needs to be inside the paragraph
what about changing then just the html-tag?
I want to prevent using h1-h6 though.
SEO things
Even if it doesn't affect SEO way too much, just want to remove some side effects which might appear.
what do you mean?
like would <p> or <div> fit as well for index numbers here to be displayed?
I think <span> spans out full width of parent that's what i'm trying to tell
Or it was paragraph elements that span out full size of parent, I don't really know. :PES2_Shrug:
no, span is inline
paragraph is a paragraph
and you know how paragraphs work, in text
Imma try pseudo now.
that might not work
try it
Now astro can inject the classlist from tailwind, however cant be processed here because of SSR I think.
Might have to rely on plain css here 😄
yeah, doing anything semi-complex in tailwind gets ugly fast
by the way, i forgot to say
you need to add
text-align: center
Huhm I am assuming i'm still doing something wrong. Before pseudo element ain't even appear inside html tree 😄
https://jsfiddle.net/qo8gph2k/ <-- i actually had to make it display grid
Edit fiddle - JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
looks fire, imma take this one.
the
content
might be the hardest oneyeah
also, it's just an example
yup got it.
therefore I prefer relying on entire element cuz it can be conditionally rendered by astro.. 😄
yeah wont follow that approach anymore because taking too long, imma try again grid one with regular element.
i tried it and couldn't get it to work, for some reason
is it important to keep the pseudo element nested or can it just be attached at the end of the parent selector (paragraph) ?
&::before
and p::before
are the same, but &::before
is for nested selectorsthis does work fine without any pseudo elements.
the one ("1") isn't perfect but I am fine with this one. way more suitable and flexible than any other approach so far.
Thanks a lot! 🙂
only annoying thing remaining right now is that I have to use a static font size with any unit.. I'd prefer having a negative offset both at bottom and top so that this one would work out of the box adaptive and responsive and not require any unit value.
This would laso be great for potential bigger texts, this one wouldn't suit for them right now as it's desired that the index number is being outstanding of title + description 😄
basically, it's the style of the pseudo-element, but applied to a div
the 1 looks good enough, but it needs a font where the left side thingy is at an angle
but other than that, it looks really good
one way to make this work is with svg
with svg, the size of the number can be a lot more gradually controlled and even resizes automatically
but this looks good like that
i would center the text, as the text looks really weird on the right side
ah yes already done. this was just a sketch
but yeah I see what you mean, description has to be centered.
I just dislike having all the time text-align: center; which is why I try having justify or left align and then centered with margin-inline: auto;
with justified descriptions:
justified text always looks like absolute ass
but it is the best option to fill the space and keep the text aligned on both sides
there's no other way though with sidely aligned texts. you have to align it center because the hitbox of the element remains full width and ignores white space sadly..
yeah, i know what you mean