LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-12-2019, 11:26 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,580

Rep: Reputation: 179Reputation: 179
HTML how to force vertical-align: bottom


I have the html shown below. There is a table within a cell of a parent table. The style for the row on the inner table has a class with vertical-align: bottom, but it does not take. It aligns at top, like the parent table's row style. Why? How do I fix this?
Code:
<!DOCTYPE html>
<html>
<head>
<style>
#MAIN { width: 200px } 
#MAIN tr { vertical-align: top }   
tr.header { vertical-align: bottom }
th { border: 1px solid black }
</style>
</head>
<body>
<table id="MAIN">
<tr> 
<td>
  <table>
  <tr class="header">
    <th>the</th><th>rain<br/>in</th><th>Spain</th>
  </tr>   
  </table>
</td>   
</tr>   
</table>

</body>
</html>
 
Old 12-13-2019, 01:14 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Because id (#) is stronger than class (.).
change
tr.header { vertical-align: bottom }
to
tr#header { vertical-align: bottom }

and
<tr class="header">
to
<tr id="header">
 
2 members found this post helpful.
Old 12-13-2019, 03:16 PM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,580

Original Poster
Rep: Reputation: 179Reputation: 179
ohdoho: Excellent suggestion. I found another solution, but I like yours better. What I did was:
Code:
<style>
:
:
#MAIN tr.header { vertical-align: bottom }\
:
</style>
which let me keep the <tr class="header"> instead of changing to <tr id="header">

Thanks!
 
  


Reply

Tags
align, class, html, style



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML How to get thead and tbody to align mfoley Programming 19 03-07-2019 12:17 AM
html : force the fonts size for whole html page? Xeratul Programming 6 11-27-2012 11:54 AM
LXer: Move unity launcher to the bottom with Unity Bottom Launcher | PPA Ubuntu LXer Syndicated Linux News 0 12-19-2011 12:30 AM
How to force the vertical refreshat certain level under xfree. Valgar Linux - Hardware 1 03-08-2004 06:11 PM
Red Hat 8, HP842C, Align the print heads? itsjustme Red Hat 0 10-21-2003 03:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration