html - 为什么文本被推向圆圈的顶部

标签 html css sass primeng

我关注了this , this , thisthis问题。但解决方案不起作用,因为问题略有不同。我正在使用一个名为 <p-calendar> 的日历组件来自 primeng .这是一个month-picker实际上。此组件已在 primeng.css 中定义明确的样式.默认情况下,该组件如下所示:

enter image description here

但我想把我的造型。我希望它在悬停时被蓝色包围。我已经做到了:

enter image description here .

但如您所见,月份名称被推到顶部而不是中间。 这是我要修改的 primeng.css已经存在的 CSS

.ui-datepicker {
    width: 10px;
    padding: .2em;
    position: absolute;
}

.ui-datepicker.ui-datepicker-inline {
    display: inline-block;
    position: static;
}

.ui-datepicker .ui-datepicker-group {
    border-left-width: 0;
    border-right-width: 0;
    border-top-width: 0;
    border-bottom-width: 0;
}


/* Month Picker */
    .ui-monthpicker .ui-monthpicker-month {
    width: 33.3%;
    display: inline-block;
    text-align: center;
    padding: .5em;
    cursor: pointer;
}

.ui-datepicker-monthpicker select.ui-datepicker-year {
    width: auto;
}

我后来添加的 CSS

.ui-monthpicker-month {
    border-radius: 100% !important;
    text-decoration: none;
    margin-top: 10px;
    color: #73767b;
    font-family: 'Muli', sans-serif;
    height: 50px !important;
    width: 50px !important;
    padding: 20px 20px 20px 20px;
}

.ui-monthpicker-month:hover {
    background-color: #1474A4 !important;
    color: white !important;
    text-align: center !important;
}

我不太擅长造型。任何意见和建议都会有很大的帮助。

PS:我也尝试添加 padding-top: 15px:hover但随后它开始闪烁。

最佳答案

尝试在填充顶部和底部使用百分比并将高度元素设置为零。

.ui-monthpicker-month { 
   color: #333333; 
   border-radius: 100% !important;
   height: 0 !important;
   padding-top: 13% !important;
   padding-bottom: 20% !important; 
}

.ui-monthpicker-month:hover {
    background-color: #1474A4 !important;
    color: #fff;
}

截图如下:

---------------------------- PC ---------------- --------------

PC

---------------------------- 平板电脑---------------- --------------

Tablet

---------------------------- 电话---------------- --------------

Phone

关于html - 为什么文本被推向圆圈的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58949558/

相关文章:

javascript - 事件元素的样式父级

jquery - Bootstrap 3 选择选项切断

css - 如何使用 css 通配符选择器并将通配符值用作 scss 的属性

html - Live Sass 编译器在最新的 VSCode 后导致扩展主机崩溃

jquery - 如何限制用户在他的机器上只单击一次按钮

javascript - 使单个函数适用于多个元素

javascript - SharePoint 2013 - 使用 jQuery 交换 CSS 文件

html - 如何在页面的右侧和左侧插入边距?

html - 需要帮助在 Google 站点中设置图像按钮以响应鼠标事件?

css - SASS 变量和继承