html - 框内的动画文本

标签 html css

我有以下 jsfiddle .

使用以下代码:

HTML:

<div class="animated-box">Animated box</div>

CSS:

.animated-box {
    border:2px solid #bada55;
    border-radius: 10px 0;

    color: #bada55;
    font-size: 20px;
    font-weight:bold;
    text-align:center;

    padding:50px;
    width:200px;

    -webkit-animation:fontbulger 1s infinite;
    -moz-animation:   fontbulger 5s infinite;
    -o-animation:     fontbulger 1s infinite;
    animation:        fontbulger 1s infinite;
}

@-webkit-keyframes fontbulger {
  0%, 100% {
    font-size: 15px;
  }
  50% {
    font-size: 20px;
  }
}
@-moz-keyframes fontbulger {
  0%, 100% {
    font-size: 15px;
  }
  50% {
    font-size: 20px;
  }
}
@-o-keyframes fontbulger {
  0%, 100% {
    font-size: 15px;
  }
  50% {
    font-size: 20px;
  }
}
@keyframes fontbulger {
  0%, 100% {
    font-size: 15px;
  }
  50% {
    font-size: 20px;
  }
}

如何更改文本的大小,但不更改框的大小?

最佳答案

例如指定一个line-height

line-height:20px;

http://jsfiddle.net/uexwLy75/2/

关于html - 框内的动画文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27058115/

相关文章:

单击按钮时 JavaScript 未触发

javascript - 设置新单元格值时保留格式(Google 电子表格)

javascript - 如何从其构造函数中定义的 HTML 调用类方法?

html - 按钮内的文字不可点击

c# - 解析 HTML/CSS/PHP 文件

android - 在 HTML 中构建底部工具栏并在 IPHONE 上显示它

Javascript : drag and drop image tag

html - 我怎样才能使这个 CSS 部分移动友好?

html - 如何更改 CSS 应用顺序

CSS - 将元素定位在其他元素之上并在屏幕中间