Jump to content
WebFlake
  • 0

Video Embed Size Depending on Device


D347HxD

Question

 

Hey this is probably a very dumb question, but I am trying to embed a video into the html of my theme so it shows right above the forums and below the menu.

Currently, if I change the embed size I can only make it look good for either mobile or desktop. How would I change this script to change the embed size depending on device? My current html is:

<div style="text-align:center">

<iframe width="350" height="385" src="src="videolinkhere" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

</div>

 

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 1

try this for your iframe

<iframe width="100%" height="385" src="src="videolinkhere" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

100 % width and put in height the size you would

Best Regards
Titcrunch

French webdesigner in camel Design, Support, help and tutorials in : Forum Camel Design.

Link to comment
Share on other sites

  • 0

width="100%" => show the embed all time in full width for all device => is the easy way

for a iframe full responsive you need a css change on your div for add a position relative on her and a css change on iframe and remove size in iframe

<div class="conteneur">

<iframe src="src="videolinkhere" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

</div>
.conteneur
{
position: relative;
text-align: center;
}

.conteneur iframe
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

 

Edited by titcrunch

Best Regards
Titcrunch

French webdesigner in camel Design, Support, help and tutorials in : Forum Camel Design.

Link to comment
Share on other sites

  • 0
53 minutes ago, titcrunch said:

width="100%" => show the embed all time in full width for all device => is the easy way

for a iframe full responsive you need a css change on your div for add a position relative on her and a css change on iframe and remove size in iframe


<div class="conteneur">

<iframe src="src="videolinkhere" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

</div>

.conteneur
{
position: relative;
text-align: center;
}

.conteneur iframe
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

 

The css script should be dumped into core.css right?

Link to comment
Share on other sites

  • 0
6 hours ago, titcrunch said:

no in custom css

Okay, I have this in my globalTemplate somewhere between my <main> </main> area, which is where I put old code I provided before. (yes, I changed videourlhere to my actual link before testing)

NTRkJ6S.png

(There was a small syntax error after the first iFrame in the script you provided, you added src twice which was bugging it out)

 

Then I put this at the bottom of my custom.css file

FcK38YD.png

 

Though the video does not show on the page, it doesn't even make a blank spot where it should go. Acts as if nothing has changed.

 

By the way, when I enter the video url I am using the EMBED video link you get from YT's embed script.

Edited by D347HxD
Link to comment
Share on other sites

  • 0

cFnRah3.png

 

Like I said, nothing happens. The video does not show on the page, it doesn't even make a blank spot where it should go. Acts as if nothing has changed.

Where I am putting the code should put it right between the Home and Forums section.

If I add a <div>test</div> right where I enter the code it shows: 

Wf4oFRR.png

Link to comment
Share on other sites

  • 0
16 minutes ago, titcrunch said:

try this for your iframe


<iframe width="100%" height="385" src="src="videolinkhere" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

100 % width and put in height the size you would

This worked, removed the css script and the div for it, then removed the extra src= in this, and it worked perfectly. Thanks.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...