css - 我通过 CSS 将我的按钮四舍五入,现在它们层叠

标签 css html

我使用了两个边框选项来围绕我站点中的各种按钮,因此,它们现在通过大约一个换行符级联。 (见图:http://gyazo.com/14af343dea8b280262f6c88465659c42)

每个按钮的 HTML 和 CSS 几乎相同,因此我发布了一个示例。关于为什么会发生这种情况(我想是 div 标签)以及如何阻止它的任何想法?

编辑 - JS Fiddle 上传:http://jsfiddle.net/4phcS/

CSS:

#linkwordpress
{
    color:white;
    background-color:#5C0DAC;
    font-family:Arial, Sans-Serif;
    font-size:18px;
    text-align:center;
    width:100px;
    height:30px;
    position:relative;
    top:-90px;
    left:500px;
    line-height:28px;
    border:2px solid;
    border-radius:25px;
}

HTML:

<div id="linkwordpress">
    <a href="../wordpress">Wordpress</a>
</div>

最佳答案

不要使用 id (#),而是使用类,如下所示:

.header {
  color:white;
  text-align:center;
  background-color:#5C0DAC;
  font-family:Arial, Sans-Serif;
  font-size:30px;
  padding:0px;
  margin-bottom:10px;
  height:38px;
  width:800px;
  border:2px solid;
  border-radius:25px;
  display: inline-block;
}

并使用 display: inline-block。

<div class="header">
       Leon's CS150 Assignment
</div>
<div class="header">
       Leon's CS150 Assignment 2
</div>

关于css - 我通过 CSS 将我的按钮四舍五入,现在它们层叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22637761/

相关文章:

html - 我无法创建有序表单

javascript - 选择表中具有类的下一个元素

javascript - 如何在扫雷游戏中显示空单元格?

html - 以页眉为中心的垂直边框/分隔线

css - 修改 Chrome 扩展破坏了扩展

jquery - 如何为桌面 View 禁用响应式移动菜单 jquery 命令

javascript - HTML5 <a> Javascript 中的下载属性未处理服务器错误

html - 带 z-index : -1 的可点击图像

html - Bootswatch/Bootstrap CSS/主题在 IE7 和 IE8 中中断页面

带有 CSS 填充和边框的 HTML <td> 元素。想设置 <td> 边距以将行隔开