How to center navbar items exactly to the center? - html

Basically my items start at the center, but I want even distribution so the first item starts not in the center but a bit to the left.

some css should do the job
.navbar.center .navbar-inner {
text-align: center;
}

This is a minimal example I could come up with, https://jsfiddle.net/o8emug03/15/.
Basically, you have to use a display: flex; justify-content: center; in your navbar, and append the elements you wish to display inside.

Related

How to align arrow icons and slider dots horizontally in straight line?

I'm using react-slick to create an image slider with captions with following prototype. The only problem is I need to display text for corresponding image below the default dots position, hence I'm trying to create custom dots and arrows with onClick functions. How can I align them in center and in one row provided number of dots will be dynamic.
Here's how I would do it:
#dotsContainer {
width: 100%;
height: 3em;
display: flex;
justify-content: center;
align-items: center;
}
This would align everything put in that div in the center - but does not really prevent it from breaking if there are so many dots.

Flexbox: elements collapsing - the best approach?

Consider the following:
Consider this to be a full, 1920px screen. The div wrapping the texts and buttons seen in A is a flexbox.
When I resize the screen, the text and buttons squeeze as much as possible - as seen in B.
Eventually, when there's no more space to squeeze, it collapses into C.
Now, I've added a breakpoint so that C comes to effect at 1024px, meaning that the texts and buttons will have some padding between them so to never get glued together. For this, I added a padding: 0 50px;.
I was wondering if this - adding the padding - is the best, most efficient way of implementing this collapse given that I'm working with flexboxes.
Should this be done in a different, more appropriate way?
class {
display: flex;
flex-direction: row;
word-wrap: normal;
text-align: center;
justify-content: space-between;
height: 100%;
}
#include breakpoint-max(1068px) {
padding: 0 50px;
}
}
Thank you!
Try to add flex-wrap:wrap;. By default it is no-wrap. That's why elements squeezing. You can read more here https://css-tricks.com/snippets/css/a-guide-to-flexbox/

How to change the orientation of a html header?

I am a beginner in HTML and web design, and I am making a simple header for my website. I have a logo image aligned to the left using float left. I also have a simple navigation bar including all the other web pages that I have on my website in the header, and it is also aligned, this time to the right, with float right. However, the webpage displays not in the way I want it. Instead, it displays like this:
As you can see, the navigation bar and image are all floated to the right and left respectively, but the navigation bar is clearly below the image and the title, instead of being on the same horizontal block. How can I change this? I want the navigation bar to be directed right of the title and image. I tried using display: inline but it did not work.
Thanks in advance...
Forget float. Use flex
.header {
display: flex;
justify-content: space-between;
}
Read about CSS flex-box layout. It will speed up your work and make it more pleasant.
pls adding header class
.header {
display: flex;
align-items: center;
justify-content: space-between;
}

CSS & HTML Custom button position

i have a problem with positioning a button in a div inside a table cell.Are there any possible ways of getting the current div size(on which div user hovers over) and putting the button in the middle (Verticaly & horizontaly)?
Hope you understand why i need to get the current div size and i do not have a fixed one. Thanks!
Maybe you could try to do that with flexbox?
Add your div where you have button certain properties:
.div{
display: flex;
align-items: center;
justify-content: center;
}

Aligning images within parent element horizontally

I feel like a complete noob with this question, but I cannot get anything to work. I have social media icons within my footer and I want to center them within the block they are in.
I have tried text-align: center and margin: 0 auto;. Neither has worked.
What should I do?
Just use following css will make you social icon to center withing block.
#footer-social-images {
display: flex;
justify-content: center;
}
Working Fiddle