块级元素: head meat title style body header section fotter article aside nav menu address caption div dd dt dl form h1 ~ h6 hr table li ui ol td th tr 行内元素 a abbr b br code em i img span input textarea 等等.........
此处最好最方便的方法即是正则表达式了css
var trim = function(str){ return str.replace(/\s*/g,""); } str.replace(/\s*/g,""); //去除字符串内全部的空格 str.replace(/^\s*|\s*$/g,""); //去除字符串内两头的空格 str.replace(/^\s*/,""); //去除字符串内左侧的空格 str.replace(/(\s*$)/g,""); //去除字符串内右侧的空格
面试题摘自 Githubhtml