Skip to main content
added 12 characters in body
Source Link

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome, and Internet Explorer as far as I can see.

Put a container DIVdiv and two child DIVs inchildren divs at the same level, one for content, one for the background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

.container { position: relative; } .content { position: relative; color: White; z-index: 5; } .background { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: Black; z-index: 1; /* These three lines are for transparency in all browsers. */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; }
<div class="container"> <div class="content"> Here is the content. <br/>Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

.container { position: relative; } .content { position: relative; color: White; z-index: 5; } .background { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: Black; z-index: 1; /* These three lines are for transparency in all browsers. */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; }
<div class="container"> <div class="content"> Here is the content. <br/>Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome, and Internet Explorer as far as I can see.

Put a container div and two children divs at the same level, one for content, one for the background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

.container { position: relative; } .content { position: relative; color: White; z-index: 5; } .background { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: Black; z-index: 1; /* These three lines are for transparency in all browsers. */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; }
<div class="container"> <div class="content"> Here is the content. <br/>Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

 .container {   position: relative;  }  .content {   position: relative;   color: White;   z-index: 5;  }  .background {   position: absolute;   top: 0px;   left: 0px;   width: 100%;   height: 100%;   background-color: Black;   z-index: 1;   /* These three lines are for transparency in all browsers. */   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";   filter: alpha(opacity=50);   opacity: .5;  }
<div class="container"> <div class="content"> Here is the content. <br />Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

 .container {   position: relative;  }  .content {   position: relative;   color: White;   z-index: 5;  }  .background {   position: absolute;   top: 0px;   left: 0px;   width: 100%;   height: 100%;   background-color: Black;   z-index: 1;   /* These three lines are for transparency in all browsers. */   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";   filter: alpha(opacity=50);   opacity: .5;  }
<div class="container"> <div class="content"> Here is the content. <br />Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

.container { position: relative; } .content { position: relative; color: White; z-index: 5; } .background { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: Black; z-index: 1; /* These three lines are for transparency in all browsers. */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; }
<div class="container"> <div class="content"> Here is the content. <br/>Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background:

<div class="container"> <div class="content"> Here is the content. <br /> Background should grow to fit. </div> <div class="background"></div> </div> 

And. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

 .container { position:relative; } .content { position:relative; color:White; z-index:5; } .background { position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:Black; z-index:1; /* These three lines are for transparency in all browsers. */ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity:.5; } 

 .container { position: relative; } .content { position: relative; color: White; z-index: 5; } .background { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: Black; z-index: 1; /* These three lines are for transparency in all browsers. */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; }
<div class="container"> <div class="content"> Here is the content. <br />Background should grow to fit. </div> <div class="background"></div> </div>

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background:

<div class="container"> <div class="content"> Here is the content. <br /> Background should grow to fit. </div> <div class="background"></div> </div> 

And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

 .container { position:relative; } .content { position:relative; color:White; z-index:5; } .background { position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:Black; z-index:1; /* These three lines are for transparency in all browsers. */ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity:.5; } 

This is the best solution I could come up with, NOT using CSS 3. And it works great on Firefox, Chrome and Internet Explorer as far as I can see.

Put a container DIV and two child DIVs in the same level, one for content, one for background. And using CSS, auto-size the background to fit the content and put the background actually in the back using z-index.

 .container { position: relative; } .content { position: relative; color: White; z-index: 5; } .background { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: Black; z-index: 1; /* These three lines are for transparency in all browsers. */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; }
<div class="container"> <div class="content"> Here is the content. <br />Background should grow to fit. </div> <div class="background"></div> </div>

deleted 51 characters in body
Source Link
Yi Jiang
  • 50.2k
  • 16
  • 139
  • 137
Loading
added 23 characters in body
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134
Loading
Source Link
Görkem Paçacı
  • 1.8k
  • 1
  • 11
  • 10
Loading