how to use css to style a descendant (not a direct child) of an element?
Tags: css,table,hbox
Problem :
I am trying to override the style of a descendant(not the direct child) of an element using css.
Say, I am working on:
<table id="z_d__h3-real" class="z-hbox">
<tbody>
<tr valign="top">
-----
</tr>
</tbody>
</table>
I want to override the style to set the valign of the tr element to "center".
I tried doing:
table.z-hbox tr {
vertical-align:center;
}
This doesn't work though. I assume table.z-hbox tr is looking up for a direct child <tr>
which is not the case here. As <tr>
is wrapped inside <tbody>
How do I fix this?
Thanks, Sony
Solution :
The problem is not with the precedence. I figured out that it should be
vertical-align: middle instead of vertical-align: center
This works.
CSS Howto..
Depends on the level of control but a nuclear option that would change the font size of every li element that has a CSS class of .menu-item would be: .menu-item...
Use percentage widths on your top-level menu elements.
Try this: jsFiddle HTML: <div id="sidebar">aa</div> <div id="content">bb</div> CSS: #sidebar{ float:left; width:230px; min-height:10px; overflow:hidden; margin:auto; background: #faa; } #content{ min-height:10px; overflow:hidden; margin-left:230px; background:#cddfea; } ...
If you want things to scale to ratio, don't set a width and height... set just one of them. The browser will automatically scale the other dimension for you, based...
If you want the text ("English") to be hidden, than you have to use <img/> tag, with an alt attribute, something like: <img src="english-flag.png" alt="English" /> You can also use...
You can do it all with CSS (no need for an image): .hint { background:#F85B58; display:inline-block; position:relative; color:white; padding:20px; box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.25); } .hint:before,...
background defined later should replace the previous ones. So if you have: Site1.css which has: .img { background: ... } Site2.css which has: .img { background: ... } then Site2.css...
Try this CSS: ul { list-style-type: none; margin: 0 auto; padding: 0; text-align: center; } li { display: inline-block; } As you can see, it puts a little space between...
You can use display: inline-flex #container { display: inline-flex; flex-direction: row; flex-wrap: wrap; max-width: 200px; padding: 10px; margin: 20px; background-color: blue; } #container .item { width: 80px; height: 50px; background-color:...
If you want to output a numbered list, the best approach is to make use of <ol> tags but if you can't modify your HTML and still need to output...
Suppose you have an id to the div enclosing the hr <div id="hrDiv"> <hr> </div> To remove style you can use removeAttr property over the selector $("#hrDiv hr").removeAttr("style"); If you...
echo "<style type='text/css'>"; echo ".normalbackground {background-color: white;}"; echo ".coloredbackground {background-color: #CEED5E;}"; echo "</style>"; echo "<table border=1>"; echo "<tr><th>Product...
It is because you are only setting the transition for the height but you are also changing the element's margin as well. Try this so they transition at the same...
<fieldset> <legend>title</legend> </fieldset> You could then apply CSS to these elements to get the desired effect...
You can use .mouseover() effect from jQuery library (check here) I created an example JSFiddle with similar effect to what you wanted to achieve: JSFiddle Explanation: Div bg is over...
I'm just finishing up a mobile site project and ran in to some similar issues. First, I would reconsider your HTML structure with the div's inside of anchor. I'm not...
I don't quite get what you exactly would like, but to target and change the element after an italic I would use this jQuery and vanilla JS combination: $("#myLink").find(">i").get(0).nextSibling.nodeValue =...
See this Demo <a href="#" class="linkhover"> <span hover-title="LINK HOVER">LINK HOVER</span> </a> .linkhover { display: inline-block; overflow: hidden; perspective: 400px; -webkit-perspective: 400px; perspective-origin: 50% 50%; -webkit-perspective-origin: 50% 50%; } .linkhover span...
In order for you to dynamically alter the 'amount', I would suggest using jquery (or vanilla js, whichever is preferred) to adjust the progress bar. I have used the data-attribute...
Google Chrome (and Safari) work with the following CSS 3 prefixes -webkit-border-radius: 10px; for all corners at 10px -webkit-border-top-left-radius: 8px; -webkit-border-bottom-left-radius: 8px; for the top left corner and bottom left...
you can set in JQuery by below Line of Code, Here is DEMO $('#container').css('-webkit-mask-box-image',"url('masks/4.png')") ...
My assumption (from the first example link) is that instead of just having #sidebar stay in view, you want to have another element scroll with the window as well (i.e....
http://www.xhtml2pdf.com/ install was a little quirky for me, but otherwise it worked fine....
You don't need CSS for this. You can nest framesets and use the rows attribute, for example: <frameset cols="25%,*"> <frameset rows="*,*"> <frame src="myframe1.htm"> <frame src="myframe2.htm"> </frameset> <frame src="myframe3.htm"> </frameset> ...
see you can get your desired result through easy code :- HTML <div class="wrapper"> <div class="left">left-panel</div> <div class="right">right-panel</div> </div> CSS .wrapper { border:1px solid red; overflow:hidden; width:220px } .left {...
Create an overlay div at the end of your HTML and try adding the following CSS to your overlay div: background: none repeat scroll 0 0 black; position: fixed; display:...
:not(td) > table > tbody > tr:first-child td { color: red } Since there's no information about the parent, siblings and outer markup I've specified :not(td) as admittable direct parent...
With minor markup change, adding a textwrapper <div class="numberCircle">1</div> <div class="textwrapper"> <h2>This is a main subtitle section of the page</h2> <p class="text-muted">The content here is far longer but </div> and...
Working sample: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> </head> <body> <nav> <ul id="menu"> <li><a href="Home" title="Home">HOME</a></li> <li><a href="Project"...
div { display: table-cell; vertical-align: middle; height: 50px; border: 1px solid red; } The advantages of this method is that you can change the height of the div, change the...