css - Last-child selector -


I'm a little confused about its use: Last-Hair Selector I have different buttons with such markup: / P>

  & lt; Div class = "people" & gt; & Lt; A href = "pd.html" title = "Post Doctorate" & gt; & Lt; Div class = "people-button" & gt; Post Doctorate & lt; / Div & gt; & Lt; / A & gt; & Lt; A href = "staff.html" title = "employee" & gt; & Lt; Div class = "people-button" & gt; Staff & lt; / Div & gt; & Lt; / A & gt; & Lt; A href = "phdstudents.html" title = "PhD student" & gt; & Lt; Div class = "people-button" & gt; PhD student & lt; / Div & gt; & Lt; / A & gt; & Lt; / Div & gt;  

Now I want to give the last button a different margin below, so I tried to use it:

 . People One: The Last Child People-Button {margin-down: 5px; }  

But it seems that this is not the right selector. Any help or explanation on how to do it?

Your code is correct and works (), but only in supported browsers.
i.e .:: last-child will not work below IE9.

To see the compatibility table, see:

Secondly, this issue is that it can be notified by a major CSS rule.

Generally, the browser will show in the right pane of this element, compiled CSS Styles & amp; Amp; Use Developer Tools (F12) in your browser or context menu (right-click on anchor). ; All styles that apply (and override).


You can rewrite your code by breaking the line and work padding from div inside a , and A as display: block :

  & lt; A href = "pd.html" title = "post doctor" class = "people-button" & gt; Post Doctorate & lt; / A & gt; & Lt; A href = "staff.html" headline = "employee" class = "people-button" & gt; Staff & lt; / A & gt; & Lt; A href = "phdstudents.html" headline = "PhD student" class = "people-button" & gt; PhD student & lt; / A & gt;  

CSS:

 . People-Button {Display: Block; }. People One: Last-Child {Padding-Down: 50px; / * If you want an inside anchor / background color: # 0aa; }. People {range: 1px solid # 000; Padding-bottom: 20px; / * If you just want the space below the container * /}  


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -