html - 输入元素溢出到 div 之外

标签 html css

我想在 div 中放置一个输入元素,但由于某种原因,输入元素溢出了 div。什么问题?

http://jsfiddle.net/aklintsevich/p1o584wg/

html:

<section class="full" id="third">       
        <div id="contact">
            <form action="#" method="post" id="form">
                <div class="email_info top white_border icomoon">
                    <div id="name_font" class="icon center_text">
                    </div>
                    <div>
                        <input type="text" name="firstname">
                    </div>
                </div>
                <div class="email_info bottom white_border icomoon">
                    <div id="email_font" class="icon center_text">

                    </div>                         
                    <div >
                        <input type="text" name="firstname">
                    </div>                        
                </div>                    
            </form>
        </div>      
</section>

CSS:

#third{
background-color:#22AFA0;       
}

#contact{       
    background-color:blue;
    margin:0px auto 30px auto;
    position:relative;
    top:30%;
    width:65%;
    height:30%;
    background-color:red;
    }

.email_info{
    height:40%;
    width:45%;
    position:absolute;
    background-color:green;
}

.message{
    position:absolute;
    right:0px;
    height:100%;
    width:45%;
    background-color:green;
}

#message_icon{
    height:40%;
    width:20%;
    background-color:blue;
    border-right:1px solid white;
    border-bottom:1px solid white;
}

#message_icon:before{
    color:white;
    display:block;
    width:100%;
    height:100%;
    text-align:center;
    line-height:80px;
    font-size:2.5em;
    content:"\e610";
}

.text_position{     
    float:right;
    position:absolute;      
}


.top{       
    top:0px;            
}


.bottom{
    bottom:0px;     
}


#form_button{       
    position:relative;
    width:65%;
    height:20%;
    /*background-color:orange;*/
}

.icon{
    width:20%;
    height:100%;
    background-color:blue;
    border-right:1px solid white;

}
.icomoon{
     font-family: 'icomoon';
     speak: none;
     font-style: normal;
     font-weight: normal;
     -webkit-font-smoothing: antialiased;
}

.white_border{      
    border:2px solid white;     
}
.center_text{       
    text-align:center;      
}

#name_font:before{
    font-size:2.5em;
    display:block;
    width:100%;
    height:100%;
    line-height:80px;
    color:white;
    content:"\e611";        
}

#email_font:before{
    font-size:2.5em;
    display:block;
    width:100%;
    height:100%;
    line-height:80px;
    color:white;
    content:"\e60f";        
}

最佳答案

在相关的 div 中将属性 'overflow' 设置为 'auto'。例如,

.email_info{    
    overflow : auto;
}

关于html - 输入元素溢出到 div 之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25411629/

相关文章:

html - 强制div堆栈从左到右

html - 具有可滚动内容的 Flexbox 元素

html - 如何设计交替表格行的背景颜色?

html - 使用类将 CSS 应用于文本输入

html - 如何在CSS中使用相邻的兄弟选择器

javascript - 使文本框安全且不可破解

javascript - jQuery 模糊 div 不在焦点

html - vuetify v-icon 的问题

html - 无处不在的大高度

css - 重新排列彼此内的 div 标签