guide/css/guide.css
Bradley M. Kuhn 476a42bf0d In-page anchor links vs. bootstrap's fixed navbar
@keynote2k was the first to point out that the in-page anchor links in
the Guide failed to function properly, due to Bootstrap's fixed navbar.

This mixed solution of CSS and Javascript is the best solution I've been
able to come up with for the problem.  The CSS solution is obviously
preferable, and is used herein for those anchor id attributes in the
Guide that have no href of their own.

Due to problems with using a pure CSS solution where the anchor includes
both an href and a id attribute.  The Javascript solution is specific
for those cases.  I took care not to have them both happen at once, as
they would undoubtedly conflict.

I did a inordinate amount of research about this issue.  Bootstrap's own
page about the fixed navbar:
   http://getbootstrap.com/examples/navbar-fixed-top/

doesn't discuss this issue at all, but there is a bug in Booststrap's
 bugtracker:
     https://github.com/twitter/bootstrap/issues/1768

which discusses the issue.  (However, I don't understand why that bug is
closed, since none of the solutions I implement herein truly solve it).

The most useful page I found regarding this issue is this one:
  http://nicolasgallagher.com/jump-links-and-viewport-positioning/demo

which offers several pure CCS solutions (each with drawbacks and
advantages).  Unfortunately, none of those solutions consider the
question of anchor links that have both href and id attributes, and none
of them work properly in that situation.
2014-11-16 10:23:08 -05:00

140 lines
3.3 KiB
CSS

p.indent {
text-indent: 0em;
}
body {
max-width: 680px;
margin: 0 auto !important;
float: none !important;
font-family: Georgia, serif;
}
.tabbing{padding-left: 2px; padding-right:2px;}
/* The below was adapted from Bootstrap 3.0.0,
** which is:
**
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Modifications made in this project are:
* Copyright 2014 Bradley M. Kuhn
* Also licensed Apache-2.0
*/
@media print {
.quotation {
border: 1px solid #999;
page-break-inside: avoid;
}
}
.quotation {
padding: 10px 20px;
margin: 1px 50px 4px;
border: 2px solid #91908f;
background: #eceeee;
}
.quotation p {
font-size: 95%;
font-weight: 300;
line-height: 1.25;
}
.quotation p:last-child {
margin-bottom: 0;
}
.quotation small {
display: block;
line-height: 1.428571429;
color: #999999;
}
.quotation small:before {
content: '\2014 \00A0';
}
.quotation.pull-right {
padding-right: 15px;
padding-left: 0;
border-right: 5px solid #eeeeee;
border-left: 0;
}
.quotation.pull-right p,
.quotation.pull-right small {
text-align: right;
}
.quotation.pull-right small:before {
content: '';
}
.quotation.pull-right small:after {
content: '\00A0 \2014';
}
.quotation:before,
.quotation:after {
content: "";
}
.lstlisting
{
font-family: monospace, serif;
font-size: 1em;
padding: 2px 1px;
margin: 1px 5px 4px;
font-size: 90%;
color: #c7254e;
white-space: nowrap;
background-color: #f9f2f4;
border-radius: 2px;
font-size: inherit;
color: inherit;
white-space: pre-wrap;
background-color: transparent;
border: 2px solid #575857;
}
.lstlisting.label {
font-family: monospace, serif;
border: 0;
margin-bottom: 1px;
font-weight: normal;
font-size: 90%;
padding: 0;
border-radius: 0px;
color: #c7254e;
}
/* Handle issues with anchor in-page links offsets due to bootstrap's */
/* fixed top navbar. For in-page anchor links, the fixed navbar at */
/* the top obscures the text of the link that's jumped to. */
/* Most of the pure CSS solutions found online cannot handle the */
/* situation where you have an anchor with both href and id */
/* attributes. This seemed the best one for use in cases where */
/* there was is no href. in the anchor which included the id. */
.likesectionHead a[id],
.subsectionHead a[id],
.likesubsectionHead a[id],
.partHead a[id],
.likepartHead a[id],
.appendixHead a[id],
.likeappendixHead a[id],
.chapterHead a[id],
.likechapterHead a[id],
.sectionHead a[id] {
border-top: 75px solid transparent;
margin-top: -75px;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
/* Note that those anchors that contain both href and id cannot be */
/* handled this way. It casuses strange problems with the href links. */
/* The specific problem is that you get a 75px offset when the */
/* mousepointer activates the link, and the tooltip on the footnotes */
/* don't work. Therefore, the following classes are handled by the */
/* Javascript rather than CSS: */
/* chapterToc, sectionToc, subsectionToc, partToc, footnote-mark */