Centering and Resizing my <a> links
For my navigation bar, I want my links (with the white background) to be vertically centered and the text to be bigger. I've tried solving it with different display: types in my css, but nothing seems to work.
HTML
CSS
20 Replies
doing that causes the nav bat to do this
Put it in a codepen please
oh because you are not flexing your ul
that is mb I was wondering why you had inline-block on the li's
by default grid elements will try to take up the available space and are block elements
You could also use
display: inline-grid;
on the li's igI Made a code pen with the header in it: https://codepen.io/Fire_eyes2/pen/NWeyBPV?editors=1100
do you have a solution to them being right next to each other? margin would add space on the top and bottom and specifing left or right would make it uncentered
since the li is a grid I tried using column-gap and I didnt get a change
like this?
are you just using the bg colors to see whats what?
cause that matters in how you go about this
The background colors are just so I can differ between each section they arent permanet
you can just use this and no
li
stylesor space-evenly might work better if you don't have padding on the header
Yeah this works! thankyou for the help! I appriciate it!! 💚
NP! I would look at using Grid for layout too, please don't be using floats 😄 for layout*
You probably noticed having to gives heights to stuff too and how they don't really behave how you would think
generally a good mental model is to never declare a height (use mix/max) and let your content determine the height.
Grid is really good at being "full" by default too
it will make its children "fill" by default where flex child is going to shrink to a "max-content" value.
Ill try using grid for the top half of my banner, I want confident in how to tackle it so I just had them floating right for now
I want to make this a responsive website so ive been using alot of percents and im not quite sure its the bast practice for me to be doing lol. Ill definitely try to incorporate (max/min) more though
for example my content section of the page is a flex with 3 boxes at 25%, 50%, and 25% respectively.
Its a massive step up from my first site created and theres alot to learn, but here is the full site so far: https://codepen.io/Fire_eyes2/pen/jOJeEOG?editors=1100
no you shouldn't really be using %
I mean yes and no just #depends lol
Again you should be letting your content determine size of the containers.
"CSS defaults are responsive, its you that breaks it with custom CSS" - Kevin
Also grid is really great for layout period like what your trying to do you can do with
fr
units or others in the grid templatesI gotcha Ill do some reaserch about that later tonight! Once again thank you lol
I appreciate all the advice and help
I wanna plug this video here because it really helped me differ between flex and grid: https://www.youtube.com/watch?v=hT9ABJyOzwM