JS笔记CSS笔记
JS
获取当前时间
year = new Date().getFullYear(); //2024
document.write(year.toString()); //当前标签输出2024
date = new Date();
year = date.getFullYear(); //2024
month = date.getMonth() + 1; //2
day = date.getDate(); //22
date = Date(); //Thu Feb 22 2024 11:06:38 GMT+0800 (中国标准时间)
date = new Date().toLocaleDateString(); //2024/2/22
给HTML标签添加CSS
var mobileHeaderSvgButton = document.getElementById("mobileHeaderSvgButton");
mobileHeaderSvgButton.onclick = function () {
var domName = document.getElementById('mobileMenuWrapperID');
if (domName.style['max-height'] == 'none') {
domName.style['max-height'] = '0px';
} else {
domName.style['max-height'] = 'none';
}
}
CSS
PC端,平板,手机端的样式
@media (min-width: 1024px) {
.cont-wrap .cont-main .cont-rBox {
width: 380px;
}
.pop-news .imgBox{
width: 120px;
}
}
@media screen and (max-width: 1024px) and (min-width: 800px) {
.pop-news .bd .news-item .imgBox{
width: 350px;
}
}
@media screen and (max-width: 800px) and (min-width: 600px) {
.pop-news .bd .news-item .imgBox{
width: 250px;
}
}
Buy me a cup of coffee 🙂
觉得对你有帮助,就给我打赏吧,谢谢!
