Ie CSS Bug: Background-Color: Transparent Behaves Differently to Background-Color: (Any Other Colour)

IE CSS Bug: background-color: transparent behaves differently to background-color: (any other colour)

Try faking a background image or setting it to a blank.gif instead of making it transparent.

background:url(blank.gif);

See http://work.arounds.org/issue/22/positioned-anchor-not-clickable-ie6/

::selection background-color and color rendering in browsers

According to quirksmode.org, -webkit-selection and -moz-selection are indeed available. I just tested it with Chrome (18) and Firefox (13) and can confirm that it works with Firefox, but I didn't have success with -webkit-selection on Chrome (it ignored it), and according to this SO question it doesn't exist (and the answer says that ::selection should also work on all browser, but doesn't for me, too).

As already metioned in this answer, Chrome forces the selection to be transparent, but you can work around this using

background:rgba(255, 255, 255, 0.99);

For more details, checkout the linked answer by tw16


Furthermore, this works for me on FF:

::selection { /* stuff */ }
::-moz-selection { /* stuff */}

But this does not:

::selection, ::-moz-selection { /* stuff */ }

But maybe this is not related to ::selection but does apply on all pseudo elements, couldn't find an answer to that.

Div background color cuts off at viewport with doctype

The reason why the background doesn't go all the way to the right is:

By default a block element like <div> occupies the entire width of the parent, given there is no blank space in the text sample - A_Fairly_Long_Word_Or_Image, which means it renders as a single word, and won't wrap, so the the text overflows in a smaller viewport, but not for the background that sets on the div.

However, under quirks mode (without a doctype), it behaves differently, according to this article:

Overflow is treated by expanding a box. When the content of an element does not fit into the dimensions specified for it (explicitly or implicitly), then overflow: visible (the default) means that the content overflows while the box dimensions are as specified. In Quirks Mode, the dimensions change; this can easily been seen e.g. if the box has a back­ground color or a border.

How to fix that within standard mode?

Please use the standard HTML5 <!doctype html> it is highly recommended. You can set the container div to display: inline-block; + min-width: 100%;, As the size of an inline block depends on the content inside, and the min width will make it to expand even if the viewport is larger, check out the jsFiddle, resize the output frame and see.

.container {  background-color: black;  font-size: x-large;  color: red;  display: inline-block;  min-width: 100%;}
<div class="container">A_Fairly_Long_Word_Or_Image</div>

Background color not changing in Chrome when setting css in jquery

Also change your javascript

<script> src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" > $("#registerEventTerms").off('change').on('change', function() { if ($(this).prop('checked', true);) $("#eventRegister").css('background-color', '').css('border-color', '').prop('disabled', false); else $("#eventRegister").css('background-color', 'grey !important').css('border-color', 'grey !important').prop('disabled', true); });</script>

How to make navigation react to background color

I have put together the following fiddle that achieves what i think you are after.

http://jsfiddle.net/Ecx2E/1/

It works by setting way points at the 50% mark on both up and down directions. Which is not the most modular logic but it works in this case. Ideally we would detect when each dot crosses into the new area and change it's colour accordingly.

$("section").waypoint(function(direction) {
background = $(this).css('background-color');
if (direction === 'down') {
// Scrolling down
if (background == 'rgb(0, 0, 0)') {
$("#dots a").css('background-color', '#FFFFFF');
} else {
$("#dots a").css('background-color', '#000000');
}
}
},{
offset: '50%'
}).waypoint(function(direction) {
background = $(this).css('background-color');
if (direction === 'up') {
// Scrolling up
if (background == 'rgb(255, 255, 255)') {
$("#dots a").css('background-color', '#FFFFFF');
} else {
$("#dots a").css('background-color', '#000000');
}
}
},{
offset: '50%'
});

This could be made a lot cleaner with some refactoring but this should be enough to get you going in the right direction.

IE9 Problems with link Cascading order?

Please check you div like <a href="#" class="nolinkcolor">Your test</a>. Also it matter parent container for link. If it is inside other container. you have to overwrite CSS. like:

modify CSS like:

body #parentContainerID or class a.nolinkcolor {}

Hyper link Color-styling in CSS

Visited: A link when it has already been visited (exists in the browser's history), styled using the :visited pseudo-class.

So if you have visited your link at least once it will always be visited

You can read more about this here.

How do I set a background-color for the width of text, not the width of the entire element, using CSS?

Put the text in an inline element, such as a <span>.

<h1><span>The Last Will and Testament of Eric Jones</span></h1>

And then apply the background color on the inline element.

h1 {
text-align: center;
}
h1 span {
background-color: green;
}

An inline element is as big as its contents is, so that should do it for you.

Anyway to prevent the Blue highlighting of elements in Chrome when clicking quickly?

You can use pure CSS to accomplish this. Here's a rundown for multi-browser support, chrome being covered by the first line and the final :focus bit. Details below.

.noSelect {
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.noSelect:focus {
outline: none !important;
}

Simply add the class="noSelect" attribute to the element you wish to apply this class to. I would highly recommend giving this CSS solution a try. Some have suggested using JavaScript, but I believe this is the cleanest solution.

For Android/Safari mobile/Edge

-webkit-tap-highlight-color: transparent; is the additional rule you may be looking for. Affects Chrome desktop (esp. with touchscreen) and mobile devices. Here's a warning about using this non-standard property, as well as some accessibility concerns with suggestions. Best practice is to replace the highlight with your own styling.

UPDATE: Later versions of Chrome...

A commenter on this answer pointed out :focus { outline: none !important;} is needed for newer versions of Chrome. Answer adapted to include this, as well! Ah, ever-changing standards.



Related Topics



Leave a reply



Submit