塊級元素: 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