| | |
valign='middle' not working!!
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2009
Posts: 22
Reputation:
Solved Threads: 0
i have a variable which is an image
i want it to be in the center of the td but it doesn't center vertically, it stays at the top, i did this
any ideas?
HTML and CSS Syntax (Toggle Plain Text)
$image = "<img src='$imagelocation' width='50px' height='50px'>";
i want it to be in the center of the td but it doesn't center vertically, it stays at the top, i did this
HTML and CSS Syntax (Toggle Plain Text)
echo "<td valign='middle'><div class='rollover' align='center'> <a href=\"imageview.php?id=$number\" onmouseover=\"ChgText($keyword)\">$image</a> </div> </td>";
any ideas?
0
#2 33 Days Ago
The "valign" property does not propagate from the parent to its children children!
Try testing that scenario of yours with static HTML first.
This way you can see where lies the problem.
But from where we are the problem is: the image nested in the div element.
The td valign is pointing to the div element not to the image, so the image will not be valigned because the hosting div is not required to do that with its own children too.
But in any case, the DIVs can't make your inline elements to render vertically aligned in the middle.
Also if you ask me, that DIV is not required and shouldn't be there at first place at all. Remove the div and asign its class to your image instead. >>Keep your HTML code clean.
Try testing that scenario of yours with static HTML first.
This way you can see where lies the problem.
But from where we are the problem is: the image nested in the div element.
The td valign is pointing to the div element not to the image, so the image will not be valigned because the hosting div is not required to do that with its own children too.
But in any case, the DIVs can't make your inline elements to render vertically aligned in the middle.
Also if you ask me, that DIV is not required and shouldn't be there at first place at all. Remove the div and asign its class to your image instead. >>Keep your HTML code clean.
0
#6 30 Days Ago
he needs to vertically align in the middle,
as I already mentioned with his actual code structure and his existing styles it can be fixed by simply removing the DIV wrapping his Image in TD elements, nothing else.
But, new comers never bother to come back and tell if some advice helped solve their problem or god forbid mark the thread solved.
as I already mentioned with his actual code structure and his existing styles it can be fixed by simply removing the DIV wrapping his Image in TD elements, nothing else.
But, new comers never bother to come back and tell if some advice helped solve their problem or god forbid mark the thread solved.
![]() |
Similar Threads
- whois script not working in IE (PHP)
- Move Javascript Variable to PHP (JavaScript / DHTML / AJAX)
- how to display one image per day from an array? (JSP)
- Table width (HTML and CSS)
- HTML table vertical aligning problem (HTML and CSS)
- printing webpages (JavaScript / DHTML / AJAX)
- inherited class is not found (ASP.NET)
- Scaling Flash Movies in HTML (Graphics and Multimedia)
Other Threads in the HTML and CSS Forum
- Previous Thread: External CSS problems.
- Next Thread: google on firefox address bar
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 xml xsl





