On 2010-10-19, Vinay Sajip wrote:

> On Oct 18, 9:01 pm, Guenter Milde <mi...@users.berlios.de> wrote:

>> How about ".precaption.rubric > div > pre"?


> Thanks for the suggestion - I wouldn't expect that to work (and it
> didn't, when I tried it) because the p.precaption.rubric is a sibling,
> not a parent, of the div. Essentially I want

> p.precaption.rubric + div > pre

> as a selector for the pre, but I don't believe that's supported.

Why don't you try it? It works here (Midori and Firefox).

> There's also the issue of how to select the pre (to zero its bottom
> margin) based on the fact that a postcaption is after it; AFAIK the
> "+" for adjacent siblings can only be used to select the later
> sibling, and I don't believe there's an alternative for selecting the
> earlier sibling.

How about setting the <pre> margin to zero it it is in a
highlight-python div:

div.highlight-python > pre {
  margin: 0px 3em;
}

If the next object is not a postcaption, it has a top margin, so this
should be OK. Otherwise, add required margin to the div.highlight-python.

Here are my test rules: the background-colors are used for testing
whether the selector works and how wide the margins are...

p.precaption.rubric, p.postcaption.rubric {
  color: black;
  margin-left: 3em;
  font-size: inherit;
  text-align: left;
  /*background-color: lightblue;*/
}
p.postcaption.rubric { margin-top: 0px; }
p.precaption.rubric { margin-bottom: 0px; }

div.highlight-python {
  background-color: yellow;
}  
p.precaption.rubric + div > pre {
  /* background-color: green; */
  margin: 0px 3em;
}

Günter

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to