>  기사  >  웹 프론트엔드  >  iframe 배경 투명도를 설정하는 방법

iframe 배경 투명도를 설정하는 방법

高洛峰
高洛峰원래의
2016-12-24 16:55:101257검색

IE5.5는 플로팅 프레임의 콘텐츠 투명성을 지원하기 시작합니다. 부동 프레임에 대한 투명한 내용을 정의하려면 다음 조건을 충족해야 합니다.
1. iframe 요소와 함께 사용되는 AllowTransparency 태그 속성은 true로 설정되어야 합니다.
2. iframe 콘텐츠 소스 문서에서 background-color 또는 body 요소의 bgColor 태그 속성을 투명으로 설정해야 합니다

<iframe src="./ads_top_tian.html" allowtransparency="true" style="background-color=transparent" title="test" frameborder="0" width="470" height="308" scrolling="no"></iframe>

물론 색상이 설정되지 않는다는 전제입니다.
위에서 우리는 주로 style="Background-color=transparent"라는 코드를 스타일로 보았기 때문에 다음 4가지 IFRAME 작성 방법을 통해 어떻게 해야 하는지 명확히 이해해야 한다고 생각합니다. iframe 배경 투명도 효과 달성:

<IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true"></IFRAME>
<IFRAME ID="Frame2" SRC="transparentBody.htm" allowTransparency="true" STYLE="background-color: green"> </IFRAME>
<IFRAME ID="Frame3" SRC="transparentBody.htm"></IFRAME>
<IFRAME ID="Frame4" SRC="transparentBody.htm" STYLE="background-color: green"> </IFRAME>

이제 예를 살펴보겠습니다
이 예는 주로 iframe 객체의 AllowTransparency 속성이 true로 설정되고 배경색이 적용됩니다. iframe에 의해 로드된 페이지가 투명으로 설정되면 iframe이 투명해집니다.
allowTransparency는 객체가 투명할 수 있는지 여부를 설정하거나 가져옵니다.
bgColor는 객체의 배경색을 설정하거나 가져옵니다

상위 페이지

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>父页面</title>
</head>
<body bgcolor="#FF0000">
<iframe src="index.htm"  allowTransparency="true"></iframe>
</body>
</html>

하위 페이지

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>子页面</title>
<style type="text/css">
body
{
    background-color: transparent; 
}
</style>
</head>
<body>
</body>
</html>



iframe 배경 투명도 설정 방법에 대한 더 많은 관련 기사를 보려면 PHP 중국어 웹사이트를 주목하세요!


성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.