Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline code tags inside of a tags aren't formatted properly #21259

Closed
impressivewebs opened this issue Nov 30, 2016 · 1 comment
Closed

Inline code tags inside of a tags aren't formatted properly #21259

impressivewebs opened this issue Nov 30, 2016 · 1 comment

Comments

@impressivewebs
Copy link

There are rare instances where someone might be writing about code and wrapping terms in HTML's <code> tags. Sometimes these are also hyperlinked. When this happens with Bootstrap, the default styles for the code tag overpower the styles for the link, so you can't actually tell that it's a link.

You can see examples in this CodePen demo, in the second paragraph. Notice the two portions of that paragraph inside <code> tags. Both are links. The styling on the <code> portion makes the link appear like two links. Also, the 2nd link doesn't look like a link at all, because only the <code> portion is inside the link. Also, when you hover over the links, the styling looks wrong.

This happens in Bootstrap 3 and 4. Here's a demo using Bootstrap 3

An easy fix for this is to add the following:

a code {
  color: inherit;
  background: inherit;
  padding: inherit;
}

Here is a corrected version with Bootstrap 4 and here is Bootstrap 3 corrected.

You could also do all: inherit but I'm not sure if browser support for the all property is good. FWIW, most code bases have this problem, including ZURB's Foundation (I'll file an issue with them too).

@cvrebert
Copy link
Collaborator

cvrebert commented Dec 1, 2016

I'm not sure if browser support for the all property is good.

Not supported in any Microsoft browser: http://caniuse.com/#feat=css-all

@mdo mdo added this to the v4.0.0-alpha.6 milestone Dec 22, 2016
mdo added a commit that referenced this issue Dec 22, 2016
Fixes #21259. Removes the background, color, and padding on code elements within anchors.
@mdo mdo added the has-pr label Dec 22, 2016
mdo added a commit that referenced this issue Dec 22, 2016
* Restyle code elements in links

Fixes #21259. Removes the background, color, and padding on code elements within anchors.

* Update _code.scss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants