I'm using the excellent Jalbum to create a photo album for a website. Each page of the generated photo album is a complete webpage, so the recommended way to embed the album within a website is to use an iframe.
A problem arises when I want to style the images contained within the embedded iframe. If I add a rule such as:
img {
-ms-interpolation-mode: bicubic;
}
to my stylesheet, it does not select the images within the iframe. Is there a way to select elements contained within an embedded iframe?
Of course, I could manually edit the CSS file created by Jalbum before I embed the iframe, but I would need to remember to do this every time I regenerate the album.
You could use JavaScript code to insert a CSS include into the document of the iframe.
From my experience it is just about making CSS rules that are more specific than the rules within the iframe itself. this can be accomplished by for instance giving an ID to the iframe, and have that has the outer element, making it more specific (LESS example with a livestream embed that we are using on our platform):
#livestream-iframe-wrapper {
width: 100%;
height: 100%;
#livestream-viewer {
width: 100%;
height: 100%;
#layout0, #layout1, #layout2, #layout3 {
#layout4, #layout0-lsplayer, #layout1-lsplayer, #layout2-lsplayer, #layout3-lsplayer, #layout4-lsplayer {
width: 100%;
height: 100%;
#lsplayer {
width: 100% ;
height: 100%;
}
}
}
}
}
I cant give any specific information on how to do this for your case, but use the DOM inspector in the browser development tools to inspect the DOM and find the classes to override.
Related
I want to make the major event image on the left height larger, without affecting other pages.
https://islandeguide.com/event/
I Noticed this page has this that makes it unique
h2 class="theme-title" data-trans="Featured Events">Featured Events/h2
So I thought I may be able to do something like
page.themetitle[Featured Events] .col-sm-5 > .theme-box.theme-box-vertical > .theme-box-content img{
height: 350px;
}
I made this part up page.themetitle[Featured Events] so I knew it would not work.
Does anyone know if I can put something there that would work?
Note:
I can add CSS to custom CSS document, but that is all! I do not have access to change the HTML/PHP, also I can not add Javascript.
This website was designed in a way that makes it very difficult to target elements without changing others on different pages, as they share Classes everywhere.
Try this:
h2[data-trans="Featured Events"].theme-title + div.row div.col-sm-5 div.theme-box.theme-box-vertical img {
height: 350px;
}
Edit: You can shorten it a little using the child selector:
h2[data-trans="Featured Events"].theme-title + .row > .col-sm-5 > .theme-box.theme-box-vertical img {
height: 350px;
}
I have a less library that has multiple versions.
I have the main page that uses V1 of this library.
At a point a component of the page uses V2 of this library.
My problem is that when that component is loaded that uses V2 the styles are applied on the whole page.
Unfortunately the library is not backward compatible so it ruins the whole page :|.
Is it possible to isolate somehow that inner component from the rest of the page?
CSS Page:
Thank you!
You could put a unique identifier (id or class) on the Inner Page container, and cascade from that container in your V2 CSS to affect only its contents.
#inner-page input { width: 100%; }
#inner-page p { margin-bottom: 20px; }
Or LESS eg:
#inner-page {
input {
width: 100%;
}
p {
margin-bottom: 20px;
}
}
This will affect content in a container with a unique id whether it is dynamic or not.
When viewing an email with images off in Gmail, embedded styles will initially load correctly. However, if you click the “Display images below” link to turn images on, that causes Gmail to re-render the email markup with a different prefix for the class names and IDs.
The problem is, the email is still being styled with the previous version of the stylesheet, without updating the prefixes to match the current markup.
This means any CSS rule that depends on class name or ID selectors will stop working the moment images are turned on, leaving only element name or wildcard selectors.
I am currently using mailchimp to pass in an image, but I don't have access to that image element in the code (just the merge tag |IMAGE|) When this issue arises in Gmail, I can't access that image element. Any idea how to accomplish this?
<style>
.share-img img{
max-width: 60%;
margin-bottom: 5px;
}
#media screen and (max-width: 480px){
.share-img img{
max-width: 90%;
margin-bottom: 5px;
}
}
</style>
<div class="share-img" style="text-align: center; width: 100%;">*|IMAGE|*</div>
edit:
Here's an example of how gmail prepends classes/ID's with unique strings. The stylesheet 'share-img' class and the actually 'share-img' class have 2 different strings before them thus it is not resizing the image properly.
gmail inspect element image
try removing the space before 480px in your media query. Gmail is very annoying with CSS support. I have a feeling that's breaking it. Use the below code and see if it works now.
#media screen and (max-width:480px){
.share-img img{
max-width: 90%;
margin-bottom: 5px;
}
}
Cheers
Based on In MediaWiki, is there a way I can apply [[Image:<name>]] style resizing to external images?
Instead of adding an entry like this in the [[MediaWiki:Common.css]] page on the wiki
.image100px img { width: 100px; }
Would it be possible to change the css line with use of a mediawiki passed variable to set the width to an arbitrary value at runtime?
I now have 10 such lines to have a relative flexibility in external image sizing but would prefer to have something of the kind
.imagewidthpx img { width: {{{1}}}; }
I have no idea how to interact dynamically with common.css or even if this is feasible and I really need to embed external images with resizing.
Thanks
Something like this might work...
In MediaWiki:Commmon.css add:
.externalimage-holder {
position: relative;
}
.externalimage-holder img {
width: 100%;
height: auto;
}
then set up a template Template:Sized-external-image like this:
<div class="externalimage-holder" style="width:{{{1}}}">{{{2}}}</div>
and call it like this:
{{sized-external-image|250px|https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/%D0%A2%D1%80%D0%BE%D1%97%D1%86%D1%8C%D0%BA%D0%B8%D0%B9_%D0%BC%D0%BE%D0%BD%D0%B0%D1%81%D1%82%D0%B8%D1%80.jpg/1024px-%D0%A2%D1%80%D0%BE%D1%97%D1%86%D1%8C%D0%BA%D0%B8%D0%B9_%D0%BC%D0%BE%D0%BD%D0%B0%D1%81%D1%82%D0%B8%D1%80.jpg}}
Unfortunately I can't test it right now as I'm having some difficulties with my local installation.
i have a rather strange question:
Is there a possibility to open a only a specific div element of a website in my browser?
The reason why i want to know is, because i want to embed only the stream element of this website:
http://www.azubu.tv/channel/live_small.do?cn_id=2196420951001
The page is rather new, so they dont offer a share embed code function yet, therfore i thought about creating an Iframe which shows the stream, like this:
<iframe height="433" width="770" frameborder="0" src="http://www.azubu.tv/channel/live_small.do?cn_id=2196420951001"></iframe>
While this iframe shows the whole site, i want only to show the stream element. I checked the code of the side and the div element called "player-wrap" shows pretty much what i need.
Any ideas?
Your best option may be to contact them and request embed functionality. It's maybe not their top priority so if you must, a possible workaround could be this (modified from the SO post found here).
div{
width: 960px;
height: 424px;
overflow: hidden;
}
iframe{
position: relative;
top: -300px;
width:100%;
height:800px;
}
<div>
<iframe src="http://www.azubu.tv/channel/live_small.do?cn_id=2196420951001" autoscroll="false"></iframe>
</div>
http://jsfiddle.net/daCrosby/5PMyu/
I think the best way to do it is to use jQuery's load function to return the iframe.
For example your code would be this which would return the wrapping div of the video which is called .palyer_wrap and insert it into #target-div.
$('#target-div').load('www.azubu.tv/channel/live_small.do?cn_id=2196420951001 .palyer_wrap');