【发布时间】:2014-10-07 05:52:46
【问题描述】:
我有这个例子JSFIDDLE包含一个圆圈,但是我很难根据它的内容做出响应,在上面的例子中,当内容很长时,它会溢出圆圈.
.cd-single-point {
margin:50px;
position: absolute;
border-radius: 50%;
}
.cd-single-point > a {
position: relative;
text-align:center;
padding:2px;
text-decoration: none;
z-index: 2;
display: block;
width: 20px;
height: 20px;
border-radius: inherit;
background: #d95353;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
-webkit-transition: background-color 0.2s;
-moz-transition: background-color 0.2s;
transition: background-color 0.2s;
}
.cd-single-point::after {
/* this is used to create the pulse animation */
content: '';
position: absolute;
z-index: 1;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: inherit;
background-color: transparent;
-webkit-animation: cd-pulse 2s infinite;
-moz-animation: cd-pulse 2s infinite;
animation: cd-pulse 2s infinite;
}
我如何仅使用 css 实现这一目标?
【问题讨论】:
-
优雅的解决方案根据其内容没有响应:jsfiddle.net/webtiki/tf79qoqp/3
-
您找到解决问题的方法了吗?我的回答有帮助吗?
-
感谢@web-tiki,但请参阅:jsfiddle.net/Igaojsfiddle/70bznc75/1。即使使用最小高度,我们仍然得到相同的结果。我们不能让 tam 周围的圆圈如此之小......并尝试调整浏览器的大小。请参阅我对优雅解决方案的更新。拥抱!
-
@lgao 这是因为你应该使用
min-width而不是min-height来保持圆圈的最小尺寸:jsfiddle.net/webtiki/70bznc75/3。优雅的解决方案仍然无法根据内容调整其大小。 -
谢谢@web-tiki,已经申请了。我的意思是圈子没有反应。真正优雅的解决方案是对内容不敏感,但就我而言,圆圈内不需要超过三个字符,但我需要他的尺码套装。我删除了可能的解决方案!
标签: css responsive-design geometry css-shapes