简体   繁体   English

CSS 导航栏问题

[英]CSS Navigation bar problems

css code html code problem I'm having I have been having a AWFUL time trying to fix my html/css code to get the "logout" button to be displayed side by side with the search bar, icon and the rest of the navigation bar elements. css 代码html 代码问题 我一直在尝试修复我的 html/css 代码以使“注销”按钮与搜索栏、图标和导航栏的 Z65E8806B5C68A6AAD8 并排显示元素。 It fits in perfectly if I make it an anchor tag, but because I need it to be in a form, I need it to be a submit button type.如果我将其设为锚标记,则它非常适合,但因为我需要它在表单中,所以我需要它是提交按钮类型。 The only thing that seems to work is giving it a negative top margin which is not ideal since the more you compress the page, the higher up the button goes.唯一可行的方法是给它一个负的上边距,这并不理想,因为您压缩页面的次数越多,按钮的位置就越高。 I have no idea how to fix this and am in desperate need of some assistance.我不知道如何解决这个问题,并且迫切需要一些帮助。

Set display flex for nav/chid element to be side by side.将 nav/chid 元素的显示 flex 设置为并排。

 .navbar { display: flex; }
 <div class="navbar"> <a href="#">Link</a> <form action="#" class="navbar"> <input type="text"> <button>Button</button> </form> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM