- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在尝试了几乎所有事情之后,我似乎无法让导航栏和搜索字段相互对齐。
这是设置的 HTML 部分:
<header id="header">
<h1 class="header"></h1>
<section id="navigationWrapper">
<nav>
<a class="navLink" href="/home.html">Home</a>
<a class="navLink" href="/about.html">About</a>
<a class="navLink" href="/contact.html">Contact Us</a>
</nav>
<section id="searchQuery">
<form action="/search.aspx" id method="post">
<input type="text" id="searchQuery_field" name="search" value="search">
<input type="submit" id="searchQuery_submit" name="searchSubmit" value="Search">
</form>
</section>
</section>
</header>
补充 CSS:
/* CLASSES */
.header {color:#FFD700;}
.navLink {text-decoration:none;}
/* UNIQUE ELEMENTS */
#navigationWrapper {clear:both;}
#searchQuery form {display:inline-block;}
/* GLOBAL */
body {background-color:#f1f1f1;font-family:arial;width:100%;}
footer, header {background-color:#000000;color:#FFFFFF;left:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;margin-top:0px;padding:0px;position:fixed;right:0px;text-align:center;width:100%;}
footer {border-top:3px #FFD700 solid;bottom:0px;clear:both;} /* #FFA819 */
header {border-bottom:3px #FFD700 solid;top:0px;}
浏览器兼容性不是问题,因为已决定不支持 IE8 和更早版本。任何远程有用的建议将不胜感激。
最佳答案
你可能想做更多这样的事情
<header id="header">
<h1 class="header"></h1>
<nav>
<ul>
<li><a class="navLink" href="/home.html">Home</a></li>
<li><a class="navLink" href="/about.html">About</a></li>
<li><a class="navLink" href="/contact.html">Contact Us</a></li>
</ul>
<form action="/search.aspx" id method="post">
<input type="text" id="searchQuery_field" name="search" value="search">
<input type="submit" id="searchQuery_submit" name="searchSubmit" value="Search">
</form>
</nav>
</header>
CS
/* CLASSES */
.header {color:#FFD700;}
.navLink {text-decoration:none;}
/* UNIQUE ELEMENTS */
ul, form{float: right;}
/* GLOBAL */
body {background-color:#f1f1f1;font-family:arial;width:100%;}
footer, header {background-color:#000000;color:#FFFFFF;left:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;margin-top:0px;padding:0px;position:fixed;right:0px;text-align:center;width:100%;}
footer {border-top:3px #FFD700 solid;bottom:0px;clear:both;} /* #FFA819 */
header {border-bottom:3px #FFD700 solid;top:0px;}
您对 <section>
的使用不被认为是有意义的 HTML。多用于描述页面的主要内容。
您还可以定位特定元素,例如 nav ul li a{text-decoration:none;}
这样就不需要定义 class
对于每个链接。
关于css - 讨厌的导航和搜索字段不会对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19626962/
我看到过关于此的类似帖子,但无法让 Netbeans 在正常工作时停止在我的代码中显示错误消息 "Unable to resolve identifier nullptr"。我已正确启用 C++11,
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我有一个 cucumber 步骤,最近开始失败时 已添加到我的布局中。如果我拿 出来,我的测试都通过了。当我把它放回去时,使用 WebRat 提供的 click_link 方法
我一直致力于创建独立于 .Net 客户端运行的 WCF 服务。感谢 Google 和 StackOverflow,我已经能够创建简单的 xml 和 json 服务,而无需 Soap 包装器和一堆我不需
有人可以向我解释一下 python 在 ubuntu 9.04 中发生了什么吗? 我正在尝试启动 virtualenv,而 --no-site-packages 标志似乎对 ubuntu 没有任何作用
我是一名优秀的程序员,十分优秀!