在divbar中将div搜索栏居中

时间:2019-01-27 21:19:01

标签: html css

我对如何使搜索栏div区域垂直居中感到困惑,我使用了margin auto,但是它没有用。 Here's the full code

maven

Here's the problem 如何在导航栏中将搜索栏div垂直居中?

1 个答案:

答案 0 :(得分:0)

我是用prot=pic(f1[,197],t1) # f1=dataframe, t1=phylogenetic tree p1=pic(f1[,1],t1) cor(prot,p1) 做的。您应该学习flexbox

flexbox
body{
	font-family: sans-serif;
	margin: 0;
	padding: 0;
}
.navbar{
	background-color: #343D46;
	position: absolute;
	width: 100%;
	text-align: center;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.navbar a{
	display: inline-block;
	float: left;
	font-size: 19px;
	text-decoration: none;
	padding: 15px 15px;
}
.navbar a:hover{
	background-color: green;
}
.dropdown{

}
.search{
	float: right;
	width: 200px;
	padding: 15px 15px;
	margin: auto 0;
	background-color: green;
}
.search input{
	float: right;
	border: none;
	outline: none;
	background: none;
}