【问题标题】:Issue with CSS Text box rendering in IEIE 中的 CSS 文本框渲染问题
【发布时间】:2020-04-19 05:16:10
【问题描述】:

我一直在尝试为我的 Uni 构建一个使用基本 HTML 和 CSS 的搜索引擎,但 IE 似乎不喜欢文本框。在 Chrome 和 Edge 中运行良好,但由于某种原因在 IE 中运行不佳。

下面附上截图。 Image in IE Image in Chrome

任何帮助将不胜感激。

搜索框和搜索文本按钮的代码:

.search-box {
    position: absolute;
    top: 260px;
    left: 46%;

    transform: translate(-50%, -50%);
    background: #2f3640;
    height: 60px;
    border-radius: 40px;
    padding: 10px;
}

.search-box:hover > .search-text {
    width: 350px;
    padding: 0 6px;

}

.search-box:hover > .search-btn {
    background: white;

}

.search-btn {
    color: #e84118;
    float: right;
    width: 40px;
    height: 40px;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;
    background: #2f3640;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 1s;

}

.search-text {
    font-family: VFRegular;
    border: 1px red solid;
    background: none;
    outline: none;
    float: left;
    padding: 0;
    color: white;
    font-size: 16px;
    -webkit-transition: 0.5s;
    -moz-transition: 0.5s;
    transition: 0.5s;
    line-height: 40px;
    width: 0px;


}

/*
.search-box:hover ~ .category-box {
    width: 400px;
    opacity: 1;
    visibility: visible;


}


.category-box:hover {
    width: 400px;
    opacity: 1;
    visibility: visible;
}

.category-box {
    position: absolute;
    align-items: center;
    top: 38%;
    left: 50%;
    text-decoration-color: white;
    transform: translate(-50%, -50%);
    background: #2f3640;
    height: 60px;
    border-radius: 40px;
    padding: 10px;
    width: 0px;
    color: white;
    visibility: collapse;
    opacity: 0;
    transition: width 1s, height 1s, transform 1s;
    transition: opacity 1s;

}
*/

.search-box > ul {
    left: -100px;
    background-color: #2f3640;
    color: white;
    border-radius: 10px;
    list-style-type: none;
    font-size: 15px;


}

.search-box > ul li {
    left: -10px;
    margin: 0 0 10px 0;
    border-bottom: 1px solid white;
    z-index: 1;
}

.search-box > ul li:last-child {
    margin: 0 0 10px 0;
    border-bottom: 1px solid transparent;
}

.search-box > ul li:hover {
    color: red;
}
<div class="entire-searchbox">
    <div class="search-box">
        <input class="search-text" type="text" placeholder="Type to search">

        <a class="search-btn" href="#">
            <i class="fas fa-search"></i>
        </a>

        <ul id="testListDummy">
        </ul>
    </div>
</div>

【问题讨论】:

    标签: javascript html css google-chrome internet-explorer


    【解决方案1】:

    你能在 .search-box 类中设置 400px 应该可以吗

    【讨论】:

    • 我也应该设置 400 像素?
    【解决方案2】:

    尝试为.search-text添加height属性,代码如下:

        .search-text {
            font-family: VFRegular;
            border: 1px red solid;
            background: none;
            outline: none;
            float: left;
            padding: 0;
            color: white;
            font-size: 16px;
            -webkit-transition: 0.5s;
            -moz-transition: 0.5s;
            transition: 0.5s;
            line-height: 40px;
            width: 0px;
            height:58px;
        } 
    

    输出如下:

    【讨论】:

    • 工作,但现在我有另一个问题(Chrome - imgur.com/ItzxBvT)(IE - imgur.com/67aphSL)。我的内容不对齐
    • 太好了,首先,我建议您可以将此答案标记为已接受的答案,因为此问题已解决,然后,当您发布新问题时,您可以创建一个关于新问题的新线程,最好像Minimal, Complete, and Verifiable example那样发布足够的代码来重现问题,社区成员可能更容易重现问题并帮助您解决问题。感谢您的理解。
    猜你喜欢
    • 1970-01-01
    • 2011-11-24
    • 2012-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-08
    • 2010-10-15
    相关资源
    最近更新 更多