---
title: "单元格内容超出宽度时隐藏多余部分<转帖>"
author: "leyoo"
date: "2010-11-03T10:21:44Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2010-11-03T10:21:44Z"
id: 801358
url: "https://leyoo.iteye.com/blog/801358"
---

单元格内容超出宽度时隐藏多余部分：

<style type="text/css">
.textOverFlow {
width:300px;
overflow:hidden;
text-overflow:ellipsis;/* (IE专用) */
white-space:nowrap;
border:1px solid #ddd;
}
</style>

有时广告经常会撑破，知道用OVERFLOW: hidden; 这个代码了，但还是无效怎么办？在后面加一句position:relative;就可以了。