How do you center your div perfectly?
Danilo Arcidiacono
@daniloarcidiacono
All comments
- Danilo Arcidiacono• 120
@daniloarcidiacono
Posted
If you have only a single tag inside body, you can try to use flexbox:
html, body { height: 100%; } body { display: flex; justify-content: center; align-items: center; }
0 - sahal akma• 30
@sahalakma
Submitted
Building Chart according to the given model is a little bit difficult. but after knowing about chart js and it's features it became easier process.
The Next Challenge was to connect the given JSON data with our bar chart. after some research i find out what is the problem and got the solution.
The only problem I am Facing now is to Edit the Tooltip Label of Bar Chart. I want to add an Extra "$" sign before the amount in tooltip, But I Can't do that. If anyone know about that Please give me solution❤️
Danilo Arcidiacono• 120@daniloarcidiacono
Posted
You can try the before selector like this:
<your-selector>::before { content: "$"; }
0 - Grzegorz• 130
@GregW1994
Submitted
Any ideas how to better position "Annual Plan $59.99/year" so it moves a bit to the left? I used margin-right, but it doesn't look good on small screens .
Danilo Arcidiacono• 120@daniloarcidiacono
Posted
Hello, I would start by adding this:
.shopping-item-details { ... flex: 1 1 auto; }
which is a short form for:
.shopping-item-details { ... flex-grow: 1; flex-shrink: 1; flex-basis: auto; }
That makes the 'Annual Plan' grow and take the available space.
Finally, add the following:
.shopping-item { .... gap: 1rem; }
gap
adds a margin between flex items.Marked as helpful
0 - PLuciano Lima• 1,290
@LucianoDLima
Submitted
I have no idea how to replicate the overlay color on top of the black and white image provided
Danilo Arcidiacono• 120@daniloarcidiacono
Posted
Didn't try this challenge yet, but I can think of two ways to tint the image with CSS:
-
Using a suitable combination of filters (see https://codepen.io/sosuke/pen/Pjoqqp);
-
Applying an overlay (with position absolute/relative) with a semi-transparent background color;
0 -
- Yakeru• 260
@ykru6
Submitted
How organize and clean my code was? Is my code a clutter, or inefficient? What could I've done better next time? What should I acknowledge in order to up my skills in CSS?
By the way, if the Web URL has problem then it's my bad, because this is my first time use Github. And this is my 2nd attempt at upload this solution, since the web crashed somehow...
Danilo Arcidiacono• 120@daniloarcidiacono
Posted
Hello, here are some things that come to mind:
-
Use BEM notation consistently to name your CSS classes (block__element--modifier);
-
The font is imported in HTML but it's not used in CSS;
-
Do not select h1, h4, p tags directly. Either add a class to such tags or use a CSS combinator to target them;
-
Use max-width for the card. Also don't set a fixed height.
-
Use CSS custom properties to centralize constants, like colors;
-
Put your CSS files in a dedicated folder;
0 -