0

几个月以来,我一直在缓慢地学习一些 HTML、CSS、Java 和 jQuery,我刚刚遇到了这个问题,我过去已经解决了,但现在我真的陷入了困境!我在容器中有一些 div,其中包括一个下拉菜单。我希望主文本框位于菜单的右侧。我试图漂浮:对,但它会飞到那里,但不会并排。这可能是一个非常愚蠢的问题,但我想我会问而不是没有帮助。很抱歉成为'n00b'......如果我的代码写得不好或类似的东西也很抱歉:/

这是我的代码:

<html>
<head>
<link type='text/css' rel='stylesheet' href='stylesheet.css'/>
<script src="jquery.min.js">
</script>
<script> 
$(document).ready(function(){
        $("#flip").click(function(){
        $("#panel").slideToggle("slow");
        $("#panel2").slideToggle("slow");
        $("#panel3").slideToggle("slow");
    });
});

<div id="container">
<div id="header"><img src="logo.jpg" style="float:left" width="100">Bourne Computing Solutions<img src="logo.jpg" style="float:right" width="100"></div>
<div id="flip">Menu (click to open)</div>
<div id="panel">Home</div>
<div id="panel2">Contents Page</div>
<div id="panel3">Find us</div>
<div id="textbox">TEXT HERE</div>

</div>

</body>
</html>

我的样式表:

    #container
{
    position:absolute;
    left:50%;
    width:1024px;
    height:100%;
    margin-left:-512px;
}



#header
{
    font-family:arial;
    font-size:32px;
    padding:10px;
    width:1002px;
    height:50px;
    text-align:center;
    background-color:#ffffff;
    border:solid 1px #000000;
}

#panel,#flip, #panel2, #panel3
{
    font-family:arial;
    padding:15px;
    width:200px;
    text-align:center;
    background-color:#ffffff;
    border:solid 1px #000000;
}

#panel
{
    padding:10px;
    width:210px;
    display:none;
}

#panel2
{
    padding:10px;
    width:210px;
    display:none;
}

#panel3
{
    padding:10px;
    width:210px;
    display:none;
}

#textbox
{
    font-family:arial;
    font-size:14px;
    padding:10px;
    width:770px;
    height:500px;
    text-align:left;
    background-color:#ffffff;
    border:solid 1px #000000;
    float:right;
}

对不起,我很傻,但我想我们都从某个地方开始......

4

1 回答 1

0

You can do it this way :

#textbox
{
    font-family:arial;
    font-size:14px;
    padding:10px;
    width:770px;
    height:500px;
    text-align:left;
    background-color:red;
    border:solid 1px #000000;
    position:absolute;
    left:210px;
    top:72px;
}

Using the absolute positioning of CSS you already uses in your code.

Check the fiddle here

于 2013-02-28T21:36:42.540 回答