使用jQuery将H1内容更改为小写 [英] Change H1 content to lowercase with jquery
问题描述
我正在寻找一种将H1内容(实际上是大写)转换为小写的方法. 理想情况下,将其更改为text-transform属性的大写css设置(如果存在于jquery中)可能很棒.因为css的方式不允许我这样做.. 这是我的起始代码:
I'm looking for a way to tranform my H1's content (actually in uppercase) to lowercase. Ideally, it could be great to change it to the capitalize css setting of text-tranform property if exist in jquery.Why in jquery ? because the css way doesn't allowed me to do so .. This is my starting code:
$('h1').each(function(){
var h1content = $(this).val().toLowerCase();
$(this).text().toLowerCase();
});
谢谢
通过将以下技巧添加到JS方式 https:来解决此问题://css-tricks.com/almanac/selectors/f/first-letter/
fix it with adding this tips to the JS way , https://css-tricks.com/almanac/selectors/f/first-letter/
输入密码:
h1.titre-vdl{
color: $violet;
&::first-letter{
text-transform: capitalize;
}
}
推荐答案
在h1标记中添加text-transform
css属性以将文本转换为小写
Add text-transform
css property to h1 tag to convert text to lowercase
$('h1').css('text-transform','lowercase');
这篇关于使用jQuery将H1内容更改为小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!