我在 span 元素的各个段落中有几行。我的意图是使用 jQuery 在我的 javascript 中提取文本并动态添加一个 blockquote 元素。除了样式之外,一切都正常工作,我不确定为什么。
我不是为任何花哨的东西而拍摄 - 文本上方/下方的线条,缩进,增加字体大小。
当我应用边框时,它适用于每条线!并且边距仅适用于第一行,而不适用于整个元素。
知道我在这里做错了什么吗?我也尝试向 Q 元素添加一个类,结果相同。
$(document).ready(function() {
$("span").each(function() {
var quote = ($(this).text());
quote = quote.substr(0,1).toUpperCase()+quote.substr(1); // Capitalize first letter
quote = ("<q>"+quote+"</q>"); // add blockquote element to string
$(this).parent().after(quote); // insert blockquote after parent of span
$("q").css( {
// "border": "3px gray" ,
// "border-style": "ridge none",
"font-size": "125%",
"margin": "1em",
"color": "red"
});
}); // end each
}); // end ready