Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何对齐标题中的元素_Html_Css - Fatal编程技术网

Html 如何对齐标题中的元素

Html 如何对齐标题中的元素,html,css,Html,Css,我似乎不知道如何使我的HTML元素不会压下其他元素 这是我的标题: BitBay标题正在向下推搜索栏,我希望它与文本对齐,这样看起来就不会很尴尬了 如果你仔细看,你会发现account按钮也被按下了一点 我尝试过使用文本对齐属性,但没有成功。有什么建议吗 HTML: 使用div来包含标题中的每个元素是一种很好的做法,这可能有助于解决问题,例如,您的锚定和输入不包含在div中,并将css添加到这些div中,而不是添加到输入或锚定元素中 别忘了检查每个div或元素的显示值。wow,你把html放在

我似乎不知道如何使我的HTML元素不会压下其他元素

这是我的标题:

BitBay标题正在向下推搜索栏,我希望它与文本对齐,这样看起来就不会很尴尬了

如果你仔细看,你会发现account按钮也被按下了一点

我尝试过使用文本对齐属性,但没有成功。有什么建议吗

HTML:


使用div来包含标题中的每个元素是一种很好的做法,这可能有助于解决问题,例如,您的锚定和输入不包含在div中,并将css添加到这些div中,而不是添加到输入或锚定元素中


别忘了检查每个div或元素的显示值。

wow,你把html放在标签里了吗?不要把
标签混在一起:
不包含页面上显示的任何内容,只包含指向外部样式表、元信息、脚本等的链接……你可以看到它从下面开始,下面是所有CSS属性。要修复其中最基本的错误,请将结束标记移动到开始标记上方。这与您的问题无关,但这是创建有效HTML的第一步
<head>
<script type="text/javascript">
  <!--
  if (screen.width <= 800) {
    window.location = "mindex.html"; //Mobile site
  }
  //-->
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BitBay</title>
<link rel="stylesheet" type="text/css" href="CSS/bootstrap.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="https://afeld.github.io/emoji-css/emoji.css" rel="stylesheet">
<link rel="icon" href="IMG/Logo.jpg">
<div id="header">
<a href="index.html"><h1>BitBay</h1></a>
<input type="text" name="search" placeholder="Search..">
<div class="dropdown">
  <button class="dropbtn"><i class="fa fa-arrow-down"></i>Account</button>
  <div class="dropdown-content">
    <a href="account.html"><i class="fa fa-key"></i>Login</a>
    <a href="signup.html"><i class="fa fa-pencil-square-o"></i>Signup</a>
    <a href="help.html"><i class="fa fa-life-ring"></i>Help & Support</a>
  </div>
</div>
</div>
<noscript>
    <div class="noscriptmsg">
    <meta http-equiv="refresh" content="0;url=javascript.html">
    </div>
</noscript>
</head>
#header input[type=text] {
    width: 130px;
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;
    margin-left: 21%;
    margin-bottom: 40%;
    position: absolute;
}

/* When the input field gets focus, change its width to 100% */
#header input[type=text]:focus {
    width: 17%;
}

/*Header Text*/
#header h1 {
    font-family: "smooth";
    font-size: 45px;
    color: #FFF;
    margin-top: 10px;
    margin-left: 30px;
    height: 0;
}

/* Make unordered list horizontle */
#header ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    margin-top: -12.5px;
    margin-left: 270px;
}

/* Make unordered list horizontle */
#header ul li {
    display: inline;
}

/* Make boxed & colored */
#header ul li a{
    text-decoration: none;
    padding: .2% 3%;
    color: #FFF; /*Text color, when not hovered*/
}

/* Make change colors, when hovered on */
#header ul li a:hover{
    color: lightgray; /*Text color*/
}

/* Header box */
#header{
    height: 60px;
    background-color: #3385ff;
    margin-top: -9px;
    margin-left: -20px;
    padding: 10px;
    width: auto;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

/*Remove line*/
#header a{
    text-decoration: none;
}