200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 让DIV标签中的p标签内容水平垂直居中

让DIV标签中的p标签内容水平垂直居中

时间:2023-10-06 21:35:48

相关推荐

让DIV标签中的p标签内容水平垂直居中

<!DOCTYPE html><html><head><meta charset="utf-8" /><title>让DIV标签中的P标签水平和垂直都居中</title><style type="text/css">div {width:400px;height:300px;border:1px solid purple;background-color: black;overflow:hidden;position:relative;display:table-cell;text-align:center;vertical-align:middle;}p {color: white;border:1px solid purple;width:100%;}* { margin:0; padding:0;}</style></head><body><div><p>我是多行文本,我要水平和垂直都居中。</p><p>且要完全兼容ff和ie。我是多行文本,我要水平和垂直都居中。且要完全兼容ff和ie。</p></div></body></html>

效果如下:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。