代码联系表格与透明背景

时间:2015-02-02 23:52:51

标签: jquery html css

我正在尝试编写一个与此主题保持联系的联系表单,但似乎无法掌握它。有人会介意帮助我。基本上我希望盒子有黑色透明背景,如接触方法div和白色文本。我希望表单位于contact-content-container div下面的页面中心。希望这是有道理的 - 我可能会混淆一些事情,这就是为什么我无法让它发挥作用。这是我到目前为止的地方......

HTML是:

<div class="contact-container">
<div class="contact-title">HOW TO GET IN TOUCH</div>
<div class="contact-content-container">
<div class="contact-method">
<div class="contact-method-image"></div>
<div class="contact-header"><strong>Address</strong></div>
<div class="contact-copy">
<p>test</p>
</div>
<div class="contact-copy">
<p>test</p>
</div>
<div class="contact-copy">
<p>test</p>
</div>
</div>
<div class="contact-method">
<div class="contact-method-image"></div>
<div class="contact-header"><strong>Phone</strong></div>
<div class="contact-copy">
<p>Phone: </p>
</div>
<div class="contact-copy">
<p>Mobile: </p>
</div>
<div class="contact-copy">
<p>Skype: skype</p>
</div>
</div>
<div class="contact-method">
<div class="contact-method-image"></div>
<div class="contact-header"><strong>Mail</strong></div>
<div class="contact-copy">
<p>test</p>
</div>
<div class="contact-copy">
<p>test</p>
</div>
<div class="contact-copy">
</div>
</div>
<div style="clear:both;"></div>
</div>
</div>

CSS是:

.contact-container {
height: 500px;
width: 100%;
float: left;
z-index: -1000;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
background-image: url(../images/contact_background.png);
background-position: center;
background-size: cover;
}

.contact-title {

text-align: center;
width: 100%;
margin-bottom: 10px;
margin-top: 40px;
font-size: 30px;
height: auto;
font: 200 18px/1.3 'Roboto', 'Helvetica Neue', 'Segoe UI Light', sans-serif;
font-size: 30px;
font-weight: 200;
color:#FFF;
}

.contact-content-container {
height: auto;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-top: 20px
}

.contact-method {
width: 31%;
height: 192px;
float: left;
margin-left: 20px;
background: rgba(0,0,0,.5);
}   

.contact-method-image {
width: 38px;
height: 50px;
background-image: url(../images/location_icon.png);
margin-right: auto;
margin-left: auto;
margin-top: 20px;
margin-bottom: 20px;
opacity:0.4;
}

.contact-copy {
height:auto;
width:100%;
text-align:center;
margin-top:2px;
color:#FFF;

}

.contact-header {
height:auto;
width:100%;
text-align:center;
margin-bottom:10px;
color:#FFF;

}

提前致谢

1 个答案:

答案 0 :(得分:0)

不完全确定你之后...我认为一个问题是我们无法看到你在css中引用的图像,因为它们是本地的。也许这会帮助你朝着正确的方向前进?

<html>
<head>
<style>
.contact-container {
height: 500px;
width: 100%;
float: left;
z-index: -1000;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
background-image: url(../images/contact_background.png);
background-position: center;
background-size: cover;
}

.contact-title {

text-align: center;
width: 100%;
margin-bottom: 10px;
margin-top: 40px;
font-size: 30px;
height: auto;
font: 200 18px/1.3 'Roboto', 'Helvetica Neue', 'Segoe UI Light', sans-serif;
font-size: 30px;
font-weight: 200;
color:#FFF;
}

.contact-content-container {
height: auto;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-top: 20px
}

.contact-method {
width: 31%;
height: 192px;
float: left;
margin-left: 20px;
background: rgba(0,0,0,.5);
}   

.contact-method-image {
width: 38px;
height: 50px;
background-image: url(../images/location_icon.png);
margin-right: auto;
margin-left: auto;
margin-top: 20px;
margin-bottom: 20px;
opacity:0.4;
}

.contact-copy {
height:auto;
width:100%;
text-align:center;
margin-top:2px;
color:#FFF;

}

.contact-header {
height:auto;
width:100%;
text-align:center;
margin-bottom:10px;
color:#FFF;

}

form{
width:800px;
margin: 20px auto;
color:#FFF;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
background-color: rgba(0,0,0,.5);
padding:1em;
}


.row{
float:left;
clear:both;
width:100%;
}

.button-row{
float:left;
clear:both;
width:100%;
padding-right:10%;
text-align:right;
}

.label{
    width:35%;
    float:left;
    text-align:right;
}

.input{
    width:63%;
    margin-left:2%;
    float:left;
}

</style>
</head>
<body>
<div class="contact-container">
    <div class="contact-title">HOW TO GET IN TOUCH</div>
    <div class="contact-content-container">
        <div class="contact-method">
            <div class="contact-method-image"></div>
            <div class="contact-header"><strong>Address</strong></div>
            <div class="contact-copy">
                <p>test</p>
            </div>
            <div class="contact-copy">
                <p>test</p>
            </div>
            <div class="contact-copy">
                <p>test</p>
            </div>
        </div>
        <div class="contact-method">
            <div class="contact-method-image"></div>
            <div class="contact-header"><strong>Phone</strong></div>
            <div class="contact-copy">
                <p>Phone: </p>
            </div>
            <div class="contact-copy">
                <p>Mobile: </p>
            </div>
            <div class="contact-copy">
                <p>Skype: skype</p>
            </div>
        </div>
        <div class="contact-method">
            <div class="contact-method-image"></div>
            <div class="contact-header"><strong>Mail</strong></div>
            <div class="contact-copy">
                <p>test</p>
            </div>
            <div class="contact-copy">
                <p>test</p>
            </div>
            <div class="contact-copy">
            </div>
        </div>
        <div style="clear:both;"></div>
    </div>
    <div>
        <form action="#">
            <div class="row">
                <label class="label" for="first_name">First Name:</label>
                <div class="input">
                    <input type="text" name="first_name"/>
                </div>
            </div>
            <div class="button-row">
                <input type="submit"/>
            </div>
            <div style="clear:both;"></div>
        </form>
    </div>
</div>
</body>
</html>