要防止清除现有内容,你可以使用preserve
属性来指定是否保留已有内容。下面是一个示例代码:
HTML文件:
This is the existing content.
CSS文件:
[preserve] {
white-space: pre;
}
使用属性选择器[preserve]
来选择具有preserve
属性的元素,并将white-space
属性设置为pre
,这将保留元素中的换行和空格。
请注意,这只是一个示例,你可以根据自己的需求进行修改。