【问题标题】:Putting Button within divider in css将按钮放在css中的分隔符内
【发布时间】:2013-07-21 18:48:35
【问题描述】:

我想通过 css 实现这个想法:

在 CSS 中最好的方法是什么? 非常感谢!!

更新

我以前用 Headings 做过这个技巧,更多信息在这里: Putting Heading within 2 horizontal lines in CSS

但是当我尝试编辑标题版本时,按钮也无法使用。

【问题讨论】:

  • 抱歉没发,我马上更新
  • 抱歉,目前还不清楚您的目标是什么?你只想要一个右对齐的check more 圆角边框?
  • 你看不到灰色的分隔线?
  • khalid,我看到了这个:i.stack.imgur.com/0xU6j.png - 没有灰色...
  • @Basic 我可以看到灰色分隔线 :D 确实是因为我们的屏幕亮度不同

标签: css button divider


【解决方案1】:

http://jsfiddle.net/pB9MY/

body { background: #fff;  }

h3 {
  width: 500px;
  font: 30px Arial;
  font-weight: normal; 
  text-align: right;
  position: relative;
}

h3 span {
  background: #fff; 
  margin-right: 15%;
  padding: 0 20px;
}

h3:before {
  content: "";
  width: 100%;
  left: 0;
  top: 50%;
  position: absolute;
  z-index: -1;
  height: 0;
  border-top: 8px solid grey;
  opacity:.2
}
button{
  background-color:green;
  border:1px solid green;
  border-radius:5px;
  vertical-align:center;
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <h3><span><button>Hello</button></span></h3>
</body>
</html>

【讨论】:

  • 你很高兴解释你的答案
  • 我现在测试一下提前谢谢:)
  • 非常感谢,这就是我想要的:)
【解决方案2】:

这就是你所追求的吗?

为文本创建一个 div...

<div class="rightrounded">Some Text</div>

并应用适当的 css...

.rightrounded {
    width: 100px;
    float: right;
    border-radius: 5px;
    background-color: #008000;
    color: #fff;
    text-align: center;
}

Fiddle here

【讨论】:

  • 我现在测试一下 :) 谢谢!
  • 没有人,专注于图像,有一个水平灰色分隔线
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多