Link to home
Start Free TrialLog in
Avatar of Adam
AdamFlag for United Kingdom of Great Britain and Northern Ireland

asked on

I can't get my CSS class to work as I want (I'm a beginner)

Hi. I'm trying to re-use a bit of code on my site but am struggling to get it to do what I'd like it to do. I want to have a semi transparent white background around my text for a new section ID on my homepage. It's working for the Header section ID - with the following set up in the CSS styles file:
#header .header-left{
 background:rgba(255,255,255,0.5);
 padding-top:30px;
 margin-top:80px;
 border-radius:10px;
 }

Open in new window


I think this is a class of the section ID header , which has the following criteria set up in the CSS styles file:
 #header{
 background:url('../img/frontimage.jpg') center center no-repeat;
 background-size:cover; /*used to cover the entire page*/
 height:100%;
 color:#000000;
 display:flex;
 align-items:right;
 }

Open in new window


It is implemented in the HTML like this:

<div class="col-md-6 header-left">
<h1>Orangutan Japan</h1>
<br />
<h4>Teach English in Japan</h4>
 </div>  

Open in new window


I want to create the same thing for my contact section ID

I have set up the following in the CSS Style Sheet:
 /*CONTACT*/
 #contact{
 background:url('../img/people.jpg') center center no-repeat;/*Image we display in the header - top part of the webapge*/
 background-size:cover; /*used to cover the entire page*/
 height:100%;
 color:#000000;
 display:flex;
 align-items:center;
 padding:5rem 0;
}

 #contact .boxy{
 background:rgba(255,255,255,0.5);
 padding-top:30px;
 margin-top:80px;
 border-radius:10px;
}

Open in new window


And I tried to implement in the HTML like this:
<div class="container text-xs-center">
	 		 <div class ="row">
	 	 	   		<div class ="col-md-12 boxy">
						
						<h1>Contact Us</h1>
						<hr width="30%">
			  			<br><br>
						<h1><a href="contact.php">Get in touch</a></h1>
						<p><a href="contact.php">Contact us at OrangutanJapan</a></p>
			
     				</div>	
			  </div>
		
 </div><!--end the container -->  

</section>

Open in new window


But it doesn't work and I don't get the background around the text (I don't get anything). Is there something obvious I'm not doing correctly? I've been playing around with it for three hours now and can't seem to configure it correctly.
Any help would be greatly appreciated.

Many thanks.
Avatar of Adam
Adam
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Happy to upload anything to help resolve this. Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adam

ASKER

Many thanks Scott. Worked just as you said.
Thanks.