-2
我想在轉到Facebook的元標記屬性上使用大寫字母。元標記上的CSS
即:
<meta property="og:title" content="this is the great title to a post" />
編輯:
我想:
.property og:title {
text-transform: capitalize:
}
這沒有奏效。
我該怎麼做?
我想在轉到Facebook的元標記屬性上使用大寫字母。元標記上的CSS
即:
<meta property="og:title" content="this is the great title to a post" />
編輯:
我想:
.property og:title {
text-transform: capitalize:
}
這沒有奏效。
我該怎麼做?
這裏有一些讓你開始。
function capitalize(myString) {
var myString = myString.split(" ");
var capitalized = [];
for(each in myString) {
capitalized.push(
myString[each][0].toUpperCase() +
myString[each].substring(1).toLowerCase()
);
}
return capitalized.join(" ");
}
$("[property='og:title']").attr({"content": capitalize("whatever you wanna capitalize")});
沒有測試jquery的,但至少在功能工作。
爲什麼?它們不在瀏覽器中呈現。 – j08691
Facebook只是將其作爲字符串讀取。沒有樣式信息可以隨它一起使用。所以答案是:你不能。 –
_「我該怎麼做?」_ **你不能** – j08691