locked
trying to position a div within a <td> not working properly RRS feed

  • Question

  • User1451609391 posted

    Hello. I am trying to position a div within a table column. the following code is where the issue is located;

     <tr style="width:100%;" class="gradientcontainer">
                            <td height="200px"width="90%">
    
                                <div id="downpointer5" style="; display: block; left:150px; top: 0px;  width: 50px; height: 50px; background-image: url(../Content/Images/downpointer.png);" onclick="expandgradientcontainer(5)">
                                </div>
                          
    
    
    
                            </td></tr>

    Right here in the code <div id="downpointer5" style="; display: block; left:150px;

    If i set the left to a percentage like 90% instead of left:150px; it doesn't work. My code has to work this way but for some reason it just wont accept a percentage or Calc(100%- 20px) just only pixels. This behaviour is wierd. I cannot use relative or absolute for they wont work at all for this code so i use ; display:block;

    Does anyone know another way i can do this or why it may not be working? thanks alot

    Saturday, November 14, 2020 11:16 PM

All replies

  • User303363814 posted

    You haven't told us what you are trying to achieve.

    Create an html file with just a table in it, nothing else.  One row in the table and one cell in the row.  Show us the code that anyone can easily replicate.  Tell us what you want it to look like and what you are seeing.  Devices may also be useful - mobile? table? desktop?  

    Sunday, November 15, 2020 10:17 PM
  • User1451609391 posted

    I am trying to make a simple table but on bootstrap and on my mobile phone the table was acting up so I could not figure out why eventually I added ; display:block; to style on each table column <td> then for positioning stuff like divs inside I used and that solved everything does anyone know why this may be. Thanks 

    Sunday, November 15, 2020 11:03 PM
  • User303363814 posted

    Without telling us what you are trying to achieve it is difficult to explain why a random sort of vaguely described changes managed to achieve it.

    Sunday, November 15, 2020 11:30 PM