有什么能为这个问题在我的CSS的原因是什么? [英] What could be the reason for this issue in my css?

查看:150
本文介绍了有什么能为这个问题在我的CSS的原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前已经建立了一个表格一个表单字段(下拉菜单)和一个按钮。我所遇到的唯一问题是,当我尝试创建下面的第一个另一个下拉菜单它抛信息开箱弄乱了我原来的下拉菜单。是否有人可以来看看一看什么,我究竟做错了,因为我真的不知道为什么它的发生。

 < PHP
$显示=阵列(芝麻街冰,晃在现场,多拉活)$价格=阵列(29.99,35.49,4​​9.95,34.99,9.99);?>
< HTML和GT;
< HEAD>
<标题>< /标题><风格类型=文/ CSS>身体 {
背景:棕褐色;
FONT-FAMILY:宋体;
}#contentwrap {
背景颜色:白色;
边框:6像素darkred固体;
填充:110px;
宽度:600px的;
保证金:20像素20像素的自动汽车;
边界半径:25px的;
-moz-边界半径:25px的;
}#heading {
颜色:darkred;
字体大小:2.2em;
填充:0像素0像素19px 0像素;
保证金:-70px -90px -90px为5px;
文本对齐:中心;
}#内容{
高度:220px;
填充:80px 0像素0像素0像素;
背景重复:不重复;
背景位置:右;
}#边境 {
颜色:lightblue;
下边框:8像素双;
填充:0像素0像素65px 0像素;
保证金:-85px -80px 10px的-80px;
}#border2 {
颜色:darkred;
下边框:8像素双;
填充:0像素0像素65px 0像素;
保证金:180像素-80px 0像素-80px;
}.formtext {
颜色:lightblue;
保证金:-280px 0像素0像素-50px;
}.formtext2 {
颜色:lightblue;
保证金:-10px 0像素0像素-50px;
}.formfield {
填充:0像素;
字体大小:1EM;
宽度:250像素;
保证金:0像素0像素0像素-50px;
颜色:黑色;
边界:2px的darkred固体;
背景色:浅黄;
边界半径:4PX;
}< /风格>
< /头>
<身体GT;< D​​IV ID =contentwrap>< D​​IV ID =标题>在线订单事件表和LT; / DIV>< D​​IV ID =BORDER>< / DIV>< D​​IV ID =内容>< D​​IV ID =border2>< / DIV>< D​​IV CLASS =FORMTEXT>选择节目和LT; / DIV>
<选择类=formfieldNAME =显示>
< D​​IV CLASS =FORMTEXT>选择号码门票(最多4个)的LT; / DIV>
<选择类=formfieldNAME =门票>
< PHP
    为($ I = 0; $ I<计数($所示); $ I ++){        回声<期权价值= \\$ I\\方式>。 $显示[$ i]
            。$。 $价格[$ i]。< /选项> \\ N的;
    }?>
< /选择>< D​​IV的风格=保证金:160像素0像素80px -48px;>
    <输入类型=提交值=订单门票/>
< / DIV>< /表及GT;< / DIV> <! - 结束DIV#contentwrap - >< /身体GT;
< / HTML>


解决方案

您code的&LT的负载; DIV> 标签,但没有相应的结束< / DIV>
还有一个< /表> 没有相应的<形式的方式>

还要考虑使用缩进以方便您阅读。

编辑:好了,所以它的东西与你的保证金的CSS和使用尝试和位置的事情

I currently have built a form a form-field(pull down menu) and a button. The only issue I have run into is when I try to create another pull-down menu below the first it messes up my original pull-down menu by throwing the info out of the box. Can someone please take a look a see what I'm exactly doing wrong cause I'm not really sure why its happening.

<?php
$shows = array( "Sesame Street on Ice", "The Wiggles Live", "Dora Live" )

$prices = array( 29.99, 35.49, 49.95, 34.99, 9.99 );

?>


<html>
<head>
<title></title>

<style type="text/css">

body {
background: tan;
font-family: arial;
}

#contentwrap {
background-color: white;
border: 6px darkred solid;
padding: 110px;
width: 600px;
margin: 20px auto 20px auto;
border-radius: 25px;
-moz-border-radius: 25px;
}

#heading {
color: darkred;
font-size: 2.2em;
padding: 0px 0px 19px 0px;
margin: -70px -90px 5px -90px;
text-align: center;
}

#content {
height: 220px;
padding: 80px 0px 0px 0px;
background-repeat: no-repeat;
background-position: right;
}

#border {
color: lightblue;
border-bottom: 8px double;
padding: 0px 0px 65px 0px;
margin: -85px -80px 10px -80px;
}

#border2 {
color: darkred;
border-bottom: 8px double;
padding: 0px 0px 65px 0px;
margin: 180px -80px 0px -80px;
}   

.formtext {
color: lightblue;
margin: -280px 0px 0px -50px;
}

.formtext2 {
color: lightblue;
margin: -10px 0px 0px -50px;
}

.formfield {
padding: 0px;
font-size: 1em;
width: 250px;
margin: 0px 0px 0px -50px;
color: black;
border: 2px darkred solid;
background-color: lightyellow;
border-radius: 4px;
}   

</style>
</head>
<body>

<div id="contentwrap">

<div id="heading">Online Order Event Form</div> 

<div id="border"></div>

<div id="content">

<div id="border2"></div>

<div class="formtext">Choose a show</div>
<select class="formfield" name="Show">


<div class="formtext">Select a number of tickets (max 4)</div>
<select class="formfield" name="Tickets">


<?php
    for( $i = 0; $i < count( $shows ); $i++ ) {

        echo "<option value=\"". $i ."\">". $shows[ $i ] 
            ." $". $prices[ $i ] ."</option>\n";
    }

?>


</select>

<div style="margin:160px 0px 80px -48px;">
    <input type="submit" value="Order Tickets" />
</div>

</form>



</div> <!-- ends div#contentwrap -->

</body>
</html>

解决方案

Your code has loads of <div> tags but no corresponding closing </div>. There's also a </form> with no corresponding <form>.

Also consider using indentation for easier reading.

Edit: Okay, so it's something to do with your CSS and usage of margin to try and position things.

这篇关于有什么能为这个问题在我的CSS的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆