Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i create a border around iframe?

I am trying to add a border to some conetnt on wordpress, and because i do not know how to add a css file i was trying to do everything in html (or at least i think is html). My knowledge of coding is left to my years in highschool.

This is the content around which i want to create a simple black border of 1 or 2 px:

<iframe src="https://link_to_my_file/file.pdf" style="width:1000px; height:300px;" frameborder="1"></iframe>

however this does not work. So i tried this way:

<iframe src="https://link_to_my_file/file.pdf" style="width:1000px; height:300px;" frameborder="1"></iframe> <style> iframe.solid {border-style:solid} </style> 

but this also did not work.

How do i put things in the proper way without necessarily using a separate css file?

like image 840
simple mind Avatar asked Feb 10 '18 17:02

simple mind


2 Answers

If you want to use inline HTML styling:

 <iframe src="https://link_to_my_file/file.pdf" 
    style="width:1000px; height:300px; border: 1px solid black;"></iframe>
like image 148
filipbarak Avatar answered Nov 17 '22 22:11

filipbarak


The out put will not work in the snippet. Attribute which are deprecated in HTML5 for <iframe>

scrolling

frameborder

align

longdesc

marginwidth

instead of using these as iframe inline attribute you can use it in css

DEMO:

iframe{
border:4px solid red;
}
<iframe src="https://www.google.co.in/?gfe_rd=cr&dcr=0&ei=WyV_WvDBOY_E8wfHmba4Aw"></iframe>

visit this link for more info of deprecated attributes

https://html.com/tags/iframe/

like image 24
Nihal Avatar answered Nov 17 '22 21:11

Nihal