I have just modified some td's in a table because I am using a split colored backgrounds and my problem is that when I use a half white and half brown background, the text is not visible unless I set a text-shadow
This is how it looks when printed out on Safari. As you can see the text has a border shadow. This is all set in my code bellow.
border-radius: 5px;
border:1px;
border-color:#000;
-webkit-text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
-webkit-print-color-adjust: exact;
font-family: Arial, Helvetica, sans-serif;
font-size:40px;
text-align: center;
border-style: solid;
padding: 0px;
color: #000;
width: 80px;
height: 80px;
vertical-align: -52px;
font-weight: bold;
-webkit-print-color-adjust: exact;
}
When I try and print it out on Chrome, All Works the same a safari apart from the text shadow. Should be read mlk.
Has anyone been faced to this problem before?
Try something like this #media Print text-shadow under Chrome. see snippet below.
.shadow {
border-radius: 5px;
border: 1px;
border-color: #000;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
font-family: Arial, Helvetica, sans-serif;
font-size: 40px;
text-align: center;
border-style: solid;
padding: 0px;
color: #fff;
width: 80px;
height: 80px;
vertical-align: -22px;
font-weight: bold;
background: linear-gradient(to right, #ffffff 0%,#ffffff 48%,#752201 52%,#752201 100%);
}
/*
this is the part you are interested in
*/
#media print {
#media print and (-webkit-min-device-pixel-ratio: 0) {
.shadow {
-webkit-filter: drop-shadow(-1px 0 black) drop-shadow(0 1px black) drop-shadow(1px 0 black) drop-shadow(0 -1px black);
}
}
/*
additional print specific css styling can go here
*/
}
<div class='shadow'>mlk</div>
Related
I have styled a button which switches colors of its' borders depending on if its clicked or not (button:focus, button:active). The issue is that the colors do not change on button:focus, only on button:active. Other changes (such as adjusting background picture) of the state of button:focus works just fine.
Here's the CSS:
.buttonrod {
background:url(https://i.imgur.com/MtHnHtP.png) no-repeat;
background-position: 0px -30px;
position:relative;
background-size:cover;
width: 150px;
height: 150px;
text-decoration: none;
display: inline-block;
margin-left: 120px;
font-size: 12px;
cursor: pointer;
font-weight: bold;
border-color:transparent;
color: #E4B018;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
border-color: #757575 #2a2a2a #2a2a2a #757575;
}
.buttonrod:focus {
border-color: #2a2a2a #757575 #757575 #2a2a2a;
background-position: 0px -29px;
outline: none;
}
.buttonrod:active {
border-color: #2a2a2a #757575 #757575 #2a2a2a;
background-position: 0px -29px;
outline: none;
}
For some reason, the color of the border in the :focus state defaults to a light grey all around, instead of the different shadings I have attached. It's driving me insane. I added the line to adjust the image to create the illusion of a pressed button, and that worked both for focus and active. I am clueless, and any help is appreciated.
I'm trying to give my headings a nice embossed look. It works great in Chrome, but Firefox bows out. How can I make this effect work in both? Here's the fiddle:
https://jsfiddle.net/7p15s3nv/
And my CSS:
h1 {
background-color: #565656;
color: transparent;
text-shadow: 0px 2px 3px rgba(255,255,255,0.5);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
}
Thanks for any help.
maybe without background-clip, but a more 'classical' approach ?
h1:first-of-type {
background-color: #565656;
color: transparent;
text-shadow: 0px 2px 3px rgba(255,255,255,0.5);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
}
h1+h1 {
color: rgba(255,255,255,0.4);
text-shadow: 0 -2px rgba(0,0,0,0.6);
}
<h1>Hello there! webkit</h1>
<h1>Hello there! FF ?</h1>
fiddle to play with https://jsfiddle.net/7p15s3nv/5/
to test side by side in chrome and any other browser such as IE or FF
Is this the desired output?
h1{
font-size: 100px;
color: rgba(255,255,255,0.4);
text-shadow: 1px 2px 3px #eee, 0 0 0 #000, 1px 2px 3px #eee;
}
<h1>This is text</h1>
UPDATE
This update is to cover the last comment from question author:
h1 {
margin-top: 0;
font-size: 200px;
color: rgba(255,0,0,0.8);
text-shadow: 1px 2px 0 #EEE, 0 0 0 #000, 1px 2px 0 #EEE;
}
<h1>This is text</h1>
While background-clip is a valid CSS3 property, the text value in non-standard. That's why it does not work in most browsers.
A trick that might work for you is a combination of semi-transparent text (with rgba) and text-shadow like this:
h1 {
color: rgba(0,0,0, 0.6);
/* #FFF should be the same as background color of the text */
text-shadow: 3px 3px 6px #fff, 0 0 0 #666, 3px 3px 6px #fff;
}
<h1>TEXT</h1>
I think that the only solution is to duplicate the text in a pseudo.
Not very easy to maintain, but it can work
In case you go with this solution, to make it easier to maintain would be to set the text in an attr in the element, and use this attr for the content of the pseudo
.demo {
font-size: 200px;
color: darkgreen;
position: relative;
}
.demo:after {
content: "Hello";
position: absolute;
left: 0px;
top: 0px;
color: transparent;
text-shadow: 0px 20px 30px rgba(255, 255, 255, 0.91);
}
<div class="demo">Hello</div>
Is IE really support CSS3 box-shadow? thanks.
a {
background: -moz-linear-gradient(center top , #6CAB00 0px, #486E00 90%) repeat scroll 0 0 transparent;
border: 1px solid #315100;
box-shadow: 0 1px 0 #BBED62 inset;
border-radius: 5px 5px 5px 5px;
color: #FFFFFF;
float: right;
font-size: 17px;
font-weight: normal;
height: 32px;
line-height: 32px;
padding: 5px 10px;
text-shadow: 0 1px 0 #000000;
}
IE supports box-shadow CSS3 on the new versions. What version of IE you use?
I have problem with CSS <buttons> in Google Chrome, it shows space between <buttons>, but in Opera and IE it is OK, why?
Here is the full CSS code:
button {
border: 1px solid #bdbdbd;
text-shadow: 0 1px 1px white;
font: bold 11px Sans-Serif;
padding: 6px 8px;
white-space: nowrap;
vertical-align: middle;
color: #666;
background: -webkit-linear-gradient(top, white, #E0E0E0);
background: -moz-linear-gradient(top, white, #E0E0E0);
background: -ms-linear-gradient(top, white, #E0E0E0);
background: -o-linear-gradient(top, white, #E0E0E0);
cursor: pointer;
text-decoration: none;
margin-right: -1px;
}
Here is HTML code:
<div><button type="button">Send</button><button type="button">Reset</button></div>
Thanks for help.
Each set of buttons is contained within a div which has a margin-left of three (3) pixels.
EDIT Chrome also applies a default margin of one (1) pixel. You need to set the margin to zero (0) for the buttons to get rid of this spacing.
Seems to be a left margin as well. This corrects it in Chrome (not sure what it'll do in other browsers)... I edited the margin property.
button {
border: 1px solid #bdbdbd;
text-shadow: 0 1px 1px white;
font: bold 11px Sans-Serif;
padding: 6px 8px;
white-space: nowrap;
vertical-align: middle;
color: #666;
background: -webkit-linear-gradient(top, white, #E0E0E0);
background: -moz-linear-gradient(top, white, #E0E0E0);
background: -ms-linear-gradient(top, white, #E0E0E0);
background: -o-linear-gradient(top, white, #E0E0E0);
cursor: pointer;
text-decoration: none;
margin: 0 -1px 0 0;
}
I'm having a few issues with my background not showing for my button elements.
Here's my CSS code:
button.button-master-lite, a.button-master-lite {
background: #92AE41;
background: -moz-linear-gradient(top, #89A73E 0%, #92AE41 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#89A73E), to(#92AE41));
border: 1px solid #89A73E;
border-bottom: 1px solid #92AE41;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: inset 0 1px 0 0 #92AE41;
-webkit-box-shadow: inset 0 1px 0 0 #92AE41;
box-shadow: inset 0 1px 0 0 #92AE41;
color: #fff;
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
font-size: 11px;
font-weight: bold;
line-height: 1;
padding: 5px 8px 6px 8px;
text-align: center;
text-shadow: 0 -1px 0 #5D862F;
width: auto;
}
And here's my HTML:
<a class="button-master-lite" href="#">Order Now</a>
With IE 6 and IE 7 the background-color does not show. However, when I take off the other background declarations except the first one, the background shows.
The HTML page I have this button on has a number of divs and sub-divs with floats and position style elements, but I can't figure out which one is causing the issue. I tried putting the code on a completely blank page with only my stylesheet and it worked ok.
Is there anything in particular that would be causing the background not to show when I have other background declarations for other browsers?! Does it have anything to do with floats or other positioning elements?
I'd appreciate some assistance. Thanks.
You're resetting the background right after you set it. Use background-color for setting the color and then background-image for those CSS3 gradients.
Demo: http://codetester.org/2cef201d
This site helps a lot!
http://css3please.com/
try using background-color and background-image properties like so:
button.button-master-lite, a.button-master-lite {
background-color: #92AE41;
background-image: -moz-linear-gradient(top, #89A73E 0%, #92AE41 100%);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#89A73E), to(#92AE41));
border: 1px solid #89A73E;
border-bottom: 1px solid #92AE41;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px; -moz-box-shadow: inset 0 1px 0 0 #92AE41;
-webkit-box-shadow: inset 0 1px 0 0 #92AE41;
box-shadow: inset 0 1px 0 0 #92AE41;
color: #fff;
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
font-size: 11px;
font-weight: bold;
line-height: 1;
padding: 5px 8px 6px 8px;
text-align: center;
text-shadow: 0 -1px 0 #5D862F;
width: auto;
}
Add display:block or display:inline-block