CSS3 background-origin property does work in firefox? - background-image

I want use CSS3 property to make a complicated background image which with corner shadow and so on.Including background image,left border image,right border image.So,for the <div class="outer"></div>I write the CSS below:
.outer
{
background:url("title_main.png");
background-repeat:repeat-x;
background-clip: content;
background-origin:content;
-moz-background-clip: content;
-moz-background-origin: content;
-webkit-background-clip: content;
-webkit-background-origin:content;
-webkit-border-image:url("title_border.png") 0 15 0 15 stretch;
-moz-border-image: url("title_border.png") 0 15 0 15 stretch;
border-image:url("fancy_title.png") 0 15 0 15 stretch;
border-width:0 15px ;
width:80px;
height:32px;
}
In chrome browser it work well like:
But the firefox doesn't like this:
Why would this happened?How can I fix this?Make the firefox effect like the chrome?

The values of the background-origin property are content-box, padding-box, and border-box, according to the spec. So what you want is:
.outer {
-webkit-background-origin: content;
-moz-background-origin: content; /* Firefox 3.6 and below */
background-origin: content-box; /* Firefox 4 and above */
/* etc. */
}

Related

CSS Variables in Ionic 4

I am trying to change the color of the icon in the selected tab and am really struggling with how to overwrite the variable.
I'm doing the following:
ion-tabs {
--color-selected: #ff7800 !important;
--ion-color-contrast: #ff7800 !important;
}
I figured it out! It looks like --ion-color-contrast stems from the original them that you've applied to the component, in my case "dark". So I actually need to overwrite --ion-color-dark-contrast as follows:
ion-tabs {
--ion-color-dark-contrast: #ff7800 !important;
}
To set a CSS variable for a specific component, add the variable inside of its selector. See Ionic Variables for more information on the component-level variables Ionic provides.
/* Set the color on all ion-button elements */
ion-button {
--color: #222;
}
/* Set the background on an ion-button with the .fancy-button class */
.fancy-button {
--background: #00ff00;
}

Fancybox 3: position the iFrame in the top of the viewport?

How to position the iFrame in the top of the viewport? 20 pixels down?
Here is my Fancybox code:
$("[data-fancybox]").fancybox({
iframe : {
preload: false
},
.....
});
The content (except images) is centered using CSS only, therefore it would be something like this:
.fancybox-slide--iframe .fancybox-content {
vertical-align: top;
margin: 20px;
}

Max image width for columns in gridelements

I have some grids, where i can choose the column width via flexform (33.3% - 33.3% - 33.3% or 25% - 50% - 25%, …)
I get the max-width of the columns by using CASE with the flexform-field value and the max-width of the page:
…
3 < lib.gridelements.defaultGridSetup
3 {
columns {
1 < .default
1.renderObj = COA
1.renderObj {
10 = LOAD_REGISTER
10.colMaxWidth.cObject = CASE
10.colMaxWidth.cObject {
key.data = field:parentgrid_flexform_style
default = TEXT
default.value =
col-1-2-1 = TEXT
col-1-2-1.value = {$maxContentWidth} / 4
col-1-2-1.prioriCalc = 1
col-4-3-3 = TEXT
col-4-3-3.value = {$maxContentWidth} / 10 * 4
col-4-3-3.prioriCalc = 1
col-1-1-1 = TEXT
col-1-1-1.value = {$maxContentWidth} / 3
col-1-1-1.prioriCalc = 1
}
20.textmedia.dataProcessing.20.maxGalleryWidth.stdWrap.data = register:colMaxWidth
30 = RESTORE_REGISTER
}
2 < .1
2 {
renderObj.10.colMaxWidth.cObject {
col-1-2-1.value = {$maxContentWidth} / 2
col-4-3-3.value = {$maxContentWidth} / 10 * 3
}
}
3 < .1
3 {
renderObj.10.colMaxWidth.cObject {
col-4-3-3.value = {$maxContentWidth} / 10 * 3
}
}
}
...
}
}
This will work fine. But I don’t know what to do, if using nested grids? Then I have to get the flexform-values of the parent gridelement.
Or what is your solution to calculate the max—image-width for grid-columns?
be careful with the calculated size. especially if you use responsive layouts. in responsive layouts columns could be wider on a smaller screen as columns may appaer beneath each other than side by side.
in general: you don't have an easy way to calculate the column width of stacked gridelements. you could do very complicated TS configuration, or you might use an userfunc to solve the computation in PHP.
Did you try to use gridelements together with fluidtemplates?
In the meantime I use this in all my defined grid-elements.
Don't do this on the server side, because the server will not get noticed, when a client changes its browser dimensions. The solution to your problem can easily be fixed by using some CSS. Lets assume you do not render the width directly, but use classes for a grid-system like bootstrap and your rendered gridelement HTML structure looks like this:
<div class="row">
<div class="columns column-2"></div>
<div class="columns column-8"><img src="someimage.jpg" width="800" height="400" /></div>
<div class="columns column-2"></div>
</div>
Your column CSS would probably look like this:
.row{
width: 100%;
}
.row:after{
content: '';
clear: both;
height: 0px;
visibility: hidden;
}
.columns{
float: left;
}
.column-2{
width: 33%;
}
.column-8{
width: 66%;
}
Now you want the images inside the columns to resize with the columns themselfes. A simple max-width: 100%; should do that like so:
.columns img{
max-width: 100%;
}
Since you are using registers anyway, you can include the already calculated register to calculate the amount on deeper levels of the nested structure.
Registers are working like a stack, so with each LOAD_REGISTER you will add a new value to the register stack of colMaxWidth, with each RESTORE_REGISTER you will remove that value in favor of the former value in the stack.
While this is not recommendable performancewise, you can still calculate nested amounts by including the register into the calculation as long as the result gets cached.
When you are on highly dynamic pages with more ore less uncacheable results, you should go for another solution though.
Why don't you use the image editor in TYPO3 V7 Media-Tab?
Screenshot of the image-editor — sorry, but in German

Hide iPhone HTML5 video play button

I want to hide the big play button that appears by default on the <video> element
Is it possible?
I don't have any iOS device handy to test, but perhaps try this:
video::-webkit-media-controls {
display:none !important;
}
It seems Apple has changed the shadow-dom again.
In order to hide the play button control you must use the following CSS:
/* This used to work for the parent element of button divs */
/* But it does not work with newer browsers, the below doesn't hide the play button parent div */
*::-webkit-media-controls-panel {
display: none!important;
-webkit-appearance: none;
}
/* Old shadow dom for play button */
*::-webkit-media-controls-play-button {
display: none!important;
-webkit-appearance: none;
}
/* New shadow dom for play button */
/* This one works! */
*::-webkit-media-controls-start-playback-button {
display: none!important;
-webkit-appearance: none;
}
A look at the shadow DOM in Safari iOS tells me that what you want (hidding only the big central play button) is:
video::-webkit-media-controls-start-playback-button {
display: none !important;
}
The answer from Ian hides everything including text tracks (closed captions ...)
Newer iOS versions display such play button when the device is in "Low power mode".
In the video source file you can simply change
controls= "false"
For the Safari CSS, which the native browser on ios, you can also try this hacky trick
.custom-video-controls {
z-index: 2147483647;
}
Here's a link to a details discussion on managing/hiding controls on HTML 5 video
http://css-tricks.com/custom-controls-in-html5-video-full-screen/
UPDATE OCTOBER 2021
All answers are outdated for iOS 13, 14, and 15. It appears because iOS low power mode prevents autoplay on all videos in the browser by default (to save power).
The best way to remove the annoying play button is to remove the autoplay tag on any video element and start playing the video when there is any user interaction.
React example below:
<video ref={playerRef} playsInline >
let playVideo = (event) => {
if (playerRef.current) {
playerRef.current.play()
}
}
Sidenote: the play button is hidden in a shadow dom that I am unable to figure out how to hide with external CSS modifications or even JS. If anyone has any ideas on how to hide a shadow dom element then that would be a better solution.
Based on Ian's answer
video::-webkit-media-controls {
opacity: 0;
}
This will hide all controls. Good for background videos that won't autoplay.
Today #2017 in iOS 10 this works:
.video-background::-webkit-media-controls-panel,
.video-background::-webkit-media-controls-start-playback-button {
display: none !important;
}
For webapps.
Works iOS 10.3 iPhone7 & Safari 10.1 on Mac as well. Thx to previous contributors.
I had also the issue that the element does not contain any "control" attribute at all.
'<style type="text/css">'+
'*::-webkit-media-controls-panel {'+
' display: none!important;'+
' -webkit-appearance: none;'+
' }'+
/* Old shadow dom for play button */
'*::--webkit-media-controls-play-button {'+
'display: none!important;'+
'-webkit-appearance: none;'+
'}'+
/* New shadow dom for play button */
/* This one works */
'*::-webkit-media-controls-start-playback-button {'+
'display: none!important;'+
' -webkit-appearance: none;'+
'}'+
+'</style>'
Try this:
video {
&::-webkit-media-controls {
display:none !important;
}
&::-webkit-media-controls-start-playback-button {
display: none!important;
-webkit-appearance: none;
}
}
Update:
IOS 13.*
video::slotted::-webkit-media-controls-container{
display:none !important;
visibility: hidden!important;
opacity: 0 !important;
-webkit-appearance: none !important;
}
IOS 14
changed selector to
:host::shadow::-webkit-media-controls-container{/* hide the element */}
helpful resource:
html5rocks shadow dom 201
As of 20 Oct 2022,
My solution was to remove autoplay from the video element and use HTMLMediaElement.play() on page load. The promise returned from play() will catch any issues with playing the video, else the video will play as usual. My implementation in React looks like this:
useEffect(() => {
ref &&
ref.current
.play()
.then(() => {})
.catch((err) => {
// Video couldn't play, low power play button showing.
});
}, []);
This should be a relief from having to deal with the inconsistent Shadow DOM properties.
Resources:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play
You can't remove the play button. This video placeholder always appears as the doc says :
iPhone Video PlaceHolder. But maybe you can detect you're on an iphone and display an image with a link to your video instead of the video tag.
<img src="yourposter.png"/>
The video will be launched in a player just as a video tag.
According to this answer, in Google Chrome we can hide the big play button like this:
video::-webkit-media-controls-overlay-play-button {
display: none;
}
That might be useful if you want to hide it on Android as well as on iOS.
video::-webkit-media-controls { display:none !important; }
Didn't work for me on iOS, but
*::-webkit-media-controls-panel {
display: none!important;
-webkit-appearance: none;
}
/* Old shadow dom for play button */
*::--webkit-media-controls-play-button {
display: none!important;
-webkit-appearance: none;
}
/* New shadow dom for play button */
/* This one works */
*::-webkit-media-controls-start-playback-button {
display: none!important;
-webkit-appearance: none;
}
Worked perfect!
Yes you can do this! The trick is to "hide" the video controls, by not adding the "controls" attribute to your video tag. Then you let it be dynamically added a few seconds after the video starts to play, by appending the "controls" property to the tag using Javascript. Simply set the value to "controls" and it will dynamically appear in the DOM... as if you had added the controls to your video tag's HTML. Adjust the timer as needed.
<video id="some-video-id" src="some-video-url" poster="some-thumbnail-url" />
Start the Video
<script type="text/javascript">
var oVideoTag = document.getElementById('some-video-id');
var oLink = document.getElementById('startVideoLink');
if (oLink && oVideoTag) {
oLink.addEventListener('click',function(e) {
oVideoTag.play();
setTimeout(function() {
oVideoTag.controls = 'controls';
},2500);
},false);
}
</script>

IE9 multiple select overflow while printing

I'm having problems with IE9 ignoring the select borders when printing a multiple select.
Here's how to recreate the problem:
Open IE9 on Windows 7.
Go to w3schools's multiple select edit page.
Now highlight the options and copy/paste until there is a long list of duplicates.
Then remove the size attribute.
Click on "Edit and Click Me" so that the page reloads and you now have your modified select in the second panel.
Now, print the document (even using the XPS viewer).
For me, all of the options are printed on the page, even though the select is only 4 option elements tall. This still happens to some degree if you leave the "size" attribute at the default value of 2, but it's far more obvious when it is changed or removed.
Is anyone else experiencing this? Is this an IE bug? Does anyone know of a workaround?
You can work around this by viewing the site in IE9's compatibility mode. Usually IE will determine that it cannot display a site properly and give you the option to turn on compatibility mode from within the address bar but sometimes you need to explicitly set it.
How to turn on compatibility mode - http://www.sevenforums.com/tutorials/1196-internet-explorer-compatibility-view-turn-off.html - I used the first one in method 2.
There doesn't seem to be any CSS solution for this. Instead, I wrote a small jQuery script that copies the <select multiple> contents into a <div>, so that it can be printed. Then I applied some CSS to make it look like a select, and only show the copy when actually printing.
Script:
//jQuery required
$(function() {
if(!$.browser.msie) return false;
$('select[multiple]').each(function() {
$lPrintableDiv = $('<div data-for="' + this.id + '" />').addClass($(this).attr('class')).addClass('printable');
//update printable on changes
$(this).after($lPrintableDiv).change(function($aEvent){
updatePrintable($aEvent.target);
});
//run once on load
updatePrintable(this);
});
});
function updatePrintable($aTarget) {
var $lSelect = $($aTarget);
var $lSelected = $($aTarget).val();
var $lPrintable = $('[data-for="'+$aTarget.id+'"]');
$($lPrintable).width($lSelect.width()).height($lSelect.height());
$($lPrintable).html('');
$($aTarget).children().each(function($lElm){
$lVal = $(this).val();
$lLabel = $('<label />').text($lVal);
$lOption = $('<input type="checkbox" />').val($lVal);
if($(this).is(':selected'))
$lOption.prop('checked', true);
$lPrintable.append($lOption).append($lLabel);
});
}
CSS:
.printable {
border: 1px solid grey;
display: none;
overflow: auto;
}
.printable label {
display: block;
font: .8em sans-serif;
overflow: hidden;
white-space: nowrap;
}
.printable [type="checkbox"] {
display: none;
}
.printable [type="checkbox"]:checked + label {
background: #3399ff;
color: white;
}
#media print {
select[multiple] { display: none; }
.printable { display: inline-block; }
.printable [type="checkbox"]:checked + label { background: grey; }
}
Also see the jsFiddle and original post about this fix