-1

I have a problem with a css style. It happen when I set height to auto website

access live view by diung this go to newproject.comli.com/post.php log in with a username = shining password = asdfgh123 and then manualy go to newproject.comli.com/details.php

so my div height gets set to 0 do not know why. I am talking about #itemsCategListsform could someone help me? Here is my code:

 <div id="itemsCategListsform">
     <div id="plink">
        <div id="open">My details</div>
        <div id="closed"><a href="ads.php">My ads</a></div>
        <div id="closed"><a href="fav.php">Favorites</a></div>
     </div>
     <div id="pbase">
        <div id="detailforms">
            <p> Email:
              <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
                 <input type="email" name="email" size="30">
                 <input class="submit-buttonform" type="submit" name="updateemail" value="Update Email">
              </form>
            </p>
            <p>
              <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
                   Password: <br>
                   <input type="password" name="password" size="30"><br>
                    Re-Password: <br>
                   <input type="password" name="repassword" size="30">
                   <input class="submit-buttonform" type="submit" name="updatepassword" value="Update password" >
                </form>
                </p>
                Phone: 
                <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
                   <input type="text" name="phone" size="30">
                   <input class="submit-buttonform" type="submit" name="updatephone" value="Update phone">
                </form>
                Website:
                <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
                   <input type="text" name="website" size="30">
                   <input class="submit-buttonform" type="submit" name="updatewebsite" value="Update website">
                </form>
            </div>
        </div>
    </div>

and css :

#itemsCategListsform {
    background-color: white;
    position: relative;
    width: 930px;
    height: auto;
    left: 175px;
    top: 20px;
    border-radius: 4px;
    border: 1px solid #1a171a;
    padding-top: 40px;
    padding-left: 70px;
    -webkit-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
    -moz-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
    box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
}

#plink {
    position: relative;
    width: 200px;
    float: left;
    border-top: 1px solid black;
    border-left: 1px solid black;
    z-index: 10;
    border-radius: 4px 0 0 4px;
    -webkit-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
    -moz-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
    box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);

}
#open {
    border-bottom: 1px solid black;
    border-right: 1px solid #fbfbfe;
    text-align: center;
    line-height: 50px;
    background-color: #fbfbfe;
}
#closed {
    border-bottom: 1px solid black;
    width: 200px;
    text-align: center;
    line-height: 50px;
}
#pbase {
    border: 1px solid black;
    background-color: #fbfbfe;
    position: relative;
    width: 600px;
    height: auto;
    float: left;
    margin-left: -1px;
    border-radius: 0px 4px 4px 4px;
    -webkit-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
    -moz-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
    box-shadow: 3px 3px 5px -3px rgba(0,0,0,0.6);
}

#closed:hover a {
    display: block;
    background-color: #fbfbfe;
    border-right: 1px solid black;
}


#open:hover a {
    display: block;
}

#detailforms {
    position: relative;
    margin:0 auto;
    top: 10px;
    width: 450px;
    height: auto;
    margin-bottom: 40px;
}
DACrosby
  • 10,150
  • 3
  • 34
  • 49
Egi Dijus
  • 15
  • 9
  • Do you have a live link for the website? It's a bit easier to play around with CSS in a live environment than to diagnose just from a screenshot. This also may expose a problem outside the provided CSS that could be contributing to your problem. – Liam Dec 16 '15 at 19:10
  • hmm not realy sorr i havent set mysql on my hosting so its gives tons of errors and you probably wont understant anything , will try to set up now – Egi Dijus Dec 16 '15 at 19:13
  • 1
    could you create a https://jsfiddle.net/(or other minimum verifiable example)? otherwise I'll have to flag the question as unable to be reproduce. – Blake Yarbrough Dec 16 '15 at 19:23
  • i set up my website sql so you can access live view by diung this go to http://newproject.comli.com/post.php log in with a username = shining password = asdfgh123 and then manualy go to http://newproject.comli.com/details.php – Egi Dijus Dec 16 '15 at 19:46
  • Please post the rendered HTML, not the PHP. And IDs must be unique. You duplicated `id="closed"` – j08691 Dec 16 '15 at 20:06

3 Answers3

0

Add display: inline-block to the css of itemsCategListsform :)

Magnus Buvarp
  • 968
  • 7
  • 18
0

The height is registering as 0 because the child element is floated. CSS float takes an element out of the flow of content and wraps inline elements around it.

Your problem is here:

<div id="itemsCategListsform">
    <div id="plink">
    ...

#plink{ float: left; }
#phase{ float: left; }

I'd recommend adding a pseudo element after the parent with clear: both set.

<div id="itemsCategListsform" class="clearfix">
    <div id="plink">
    ...

.clearfix:after { 
    content: " ";
    display: block; 
    height: 0; 
    clear: both;
}

See some additional solutions here.

Community
  • 1
  • 1
DACrosby
  • 10,150
  • 3
  • 34
  • 49
0

okay with a help of DACrosby was solved easily as he said that because of float left and to solve that i just add overflow: auto; tell me if i did good or there is better solution cuz this was really easy and seems to be okay everything

Egi Dijus
  • 15
  • 9