How to center list items in flex box navigation bar?

Multi tool use
Multi tool use


I have the following code:





http://jsfiddle.net/0jh3fud9/2/



How do I center the list items ("LOGO", "REGISTER" "LOGIN", "SEARCH") within the border they are in?



Try adding the commented CSS rules to your li elements (see updated fiddle):



This will make each of the list items also behave as a flex item and will center them horizontally and vertically in their parent.



What you should do is declare your elements as a flex container as you've done.



Add the align-items: center; and justify-content: center; properties to them, but you don't really do that here, since there is no space in where you could center anything hence it doesn't know what to center it to.



Remove flex: 1; and I recommend adding padding: 10px; and a margin: 5px; and it should work. If you want them to be close to each other then only add padding.



P.S. you could also use a text-align: center;






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

kIyKtAxOWdH0,QEzMp2n2ZcS3K 7RuzwlZabd3MLe0D2w,LsGrpbHt wBHgeuCsGT7PTHaB0QmP
Wz1oX N,OvHSX b,903bqmYtzR8FiaO,tPei,8 JZq7NK0CcoO7CHoniO1DDPkjF

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận