Skip to content

hyphens

hyphens 属性定义元素内单词的连字符使用方式。

语法

css
hyphens: none | manual | auto;

常见值

说明示例
nonehyphens: none
manual手动hyphens: manual
auto自动hyphens: auto

示例

基础用法

css
/* 无 */
.none {
  hyphens: none;
}

/* 手动 */
.manual {
  hyphens: manual;
}

/* 自动 */
.auto {
  hyphens: auto;
}

高级用法

css
/* 容器 */
.container {
  hyphens: none;
}

/* 静态 */
.static {
  hyphens: none;
}

/* 相对 */
.relative {
  hyphens: none;
}

/* 绝对 */
.absolute {
  hyphens: none;
}

/* 固定 */
.fixed {
  hyphens: none;
}

/* 粘性 */
.sticky {
  hyphens: none;
}

/* 响应式布局 */
.responsive {
  hyphens: none;
}

/* 卡片布局 */
.card {
  hyphens: none;
}

/* 表单布局 */
.form {
  hyphens: none;
}

/* 图片画廊 */
.gallery {
  hyphens: none;
}

/* 混合单位 */
.mixed-units {
  hyphens: none;
}

/* 带命名的项目 */
.named-items {
  hyphens: none;
}

/* 悬停效果 */
.card {
  transition: hyphens 0.3s ease-in-out;
}

.card:hover {
  hyphens: auto;
}

浏览器兼容性

浏览器版本
Chrome1+
Firefox1+
Safari1+
Edge12+
iOS Safari1+
Android Browser1+
Chrome for Android18+

注意事项

  • hyphens 可以用于任何元素
  • hyphens 定义元素内单词的连字符使用方式
  • manual 是默认值,表示手动

相关属性

相关资源