css form- input/textarea 样式和定位.. 包括代码和图像

标签 css position border

我是网页设计的新手,所以如果这非常简单,请原谅 - 我已经尝试了我所知道的一切,但似乎不太正确。

我已经使用 html 和 css 制作了一个联系表单。理想情况下,我希望从每个标签延伸出一条 1px 的线作为输入指南。这条线应与标签底部齐平。我还想要在文本区域中垂直延伸的一系列线条,以留出额外的书写空间。

目前,Name 和 Email 的输入行没有显示,Message 的文本区域只有最底部的一行。

这是我正在使用的代码:

    <div id="contact-form">
        <div id="invite">
            <h1>Let's Talk.</h1>
            <div class="postinfo">
                <h2>Have you got a project needing an eye for detail and a creative touch? I'd love to hear from you.</h2>
            </div><!-- end postinfo -->
        </div><!-- end invite -->
        <form>

            <label for="user">Name:</label>
            <input type="text" name="user" value="" /><br />

            <label for="emailaddress">Email:</label>
            <input type="text" name="emailaddress" value="" /><br />

            <label for="comments">Message:</label>
            <textarea name="comments"></textarea><br />

            <input type="submit" name="submitbutton" id="submitbutton" value="Submit" />
        </form>
    </div><!-- end contact -->

#contact-form {
    float: left;
    margin-left: 300px;
    margin-top: 310px;
}

#invite .postinfo {
    list-style-type: none;
    width: 150px;
}

label {
    float: left;
    font-family: dalle;
    font-size: 160%;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-left: 200px;
    margin-top: -105px;
    width: 120px;
}

input, textarea {
    border-style: none;
    border-bottom: 1px solid #202020;
    margin-bottom: 5px;
    margin-left: 300px;
    margin-top: -105px;
    width: 245px;
}

textarea {
    width: 250px;
    height: 150px;
}

#submitbutton {
    background: none;
    border-style: none;
    font-family: Georgia, 
                 Constantia,
                 "Lucida Bright",
                 "Bitstream Vera Serif",
                 "Liberation Serif",
                 serif;
    margin-left: 173px;
    margin-top: 5px;
    width: 90px;
}

br {
    clear: left;
}

理想的结果:

ideal outcome

最佳答案

根据您的代码,我创建了一个 fiddle ,请参见下文。如果有任何更改或其他要求,请说明。

fiddle :http://jsfiddle.net/EaKmZ/

演示:http://jsfiddle.net/EaKmZ/embedded/result/

注意:我没有对您的代码进行太多编辑,所以存在很多不需要的 CSS。

关于css form- input/textarea 样式和定位.. 包括代码和图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9776330/

相关文章:

wpf - 删除 DataGrid 单元格虚线边框?

css - Div 边框似乎有一个 'pointed' 边缘

css - 如何使嵌套表格的背景颜色保持在父表格的范围内?

html - 通过 VS Web 服务器与 IIS 运行时奇怪的 CSS 行为

css - 移动绝对定位在其父容器之外的子元素

所有浏览器上的位置和溢出的 CSS 错误

html - position:fixed - 和其他元素

html - Rails 4 中 link_to 中的样式颜色,但内联样式显示不正确

Javascript/jQuery - 将 CSS 样式应用于类元素

css - 无法将两个 div 直接放在彼此之上