div和链接/表单的问题

时间:2014-02-24 22:31:15

标签: css class html button

所以我在div中有一个部分来制作我的左侧边栏。请记住,我是一个非常新的HTML。无论如何,这个div目前有三个按钮,但由于某种原因,我们会告诉我标签出了问题。第二个按钮的链接也一直显示在我的右侧div中。任何想法为什么会非常感谢,谢谢。

<div id="left">
    <a href="https://www.twitter.com/racinbases"><img src="icon" height="50" width="50">
    <a href="https://www.facebook.com/racinbases"><img src="icon" height="50">
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post"     target="_top" style="display: inline-block;">
        <input type="hidden" name="cmd" value="_s-xclick">
        <input type="hidden" name="encrypted" value=(removed for sanity)">
        <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"     border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
        <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"     width="1" height="1">
    </form>   
</div>

<div id='right'>

</div>


#left 
{
width: 325px; height: 1000px; float: left; background-color: red;
}

#right 
{
float:right; width: 515px; height: 1000px; background-color: blue;
}

2 个答案:

答案 0 :(得分:1)

刚刚看到代码,真的搞砸了。

在您的HTML中<a>未关闭;并在src标签中定义了一些图像扩展名,如:jpg,png。          

我建议使用BUTTON元素而不是INPUT type =“image”。 BUTTON元素更灵活。您可以向其添加图像,并且可以将其定义为提交或重置类型的按钮,而无需任何额外的JavaScript。

答案 1 :(得分:0)

我想你想做这样的事情?

 <div id = 'wrapper'>
    <div class = 'fLeft redColor'>
        <a href = "https://www.twitter.com/racinbases"><img src = "icon" height = "50" width = "50"></a>
            <a href = "https://www.facebook.com/racinbases"><img src = "icon" height = "50"></a>
                <form action = "https://www.paypal.com/cgi-bin/webscr" method = "post" target = "_top" style = "display: inline-block;">
                    <input type = "hidden" name = "cmd" value = "_s-xclick"/>
                    <input type = "hidden" name = "encrypted" value = "encrypted"/>
                    <input type = "image" src = "https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"/>
                    <img alt = "" border = "0" src = "https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width = "1" height = "1"/>
                </form>
    </div>
    <div class = 'fLeft blueColor'>
    </div>
</div>
<style>
    .fLeft {
        width: 325px;
        height: 1000px;
        float: left;
    }

    .redColor {
        background-color: red;
    }

    .blueColor {
        background-color: blue;
    }
</style>