0

i was working on this site itsquad.us .I need to add my toll free number under the banner with a background image .the code is

 <div class="call"><p>1-855-566-6006</p></div></div>

css

.call
{
color: #FD7800;
font-weight: bold;
font-size: 23px;
background:url('http://itsquad.us/wp-content/uploads/2014/06/tollfree1.png') no-repeat;
}

But the image is displaying at the left of the div .I have no idea what is happening. I have tried giving margin,postion,padding etc in css which didn't help .I want it in the center just over the homepage banner.please help me.thanks!!

asked Jun 12, 2014 at 10:35
3
  • Default is left only. where you want to display in the div?? Commented Jun 12, 2014 at 10:37
  • 1
    Top left is the default position for a background image, you can change - after the no-repeat, add right center for example. Commented Jun 12, 2014 at 10:37
  • thanks that worked . now i wanted it to display jus over the header banner.Can u help me please Commented Jun 12, 2014 at 10:41

3 Answers 3

1

Try this:

CSS

.call { 
 background: url("http://itsquad.us/wp-content/uploads/2014/06/tollfree1.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0); 
 color: #FD7800; 
 font-size: 23px; 
 font-weight: bold; 
 height: 90px; 
 padding-left: 70px; 
 width: 150px; 
}
.call p { 
 margin: 0; 
 position: relative; 
 top: 22px; 
}

HTML

<div class="call"><p>1-855-566-6006</p></div>
Rodik
4,10228 silver badges49 bronze badges
answered Jun 12, 2014 at 10:50
Sign up to request clarification or add additional context in comments.

Comments

1

I hope my example will help Codepen demo

HTML

<div class="call"><p>1-855-566-6006</p></div>

CSS

body {
 background: #ececec;
}
.call
{
color: #FD7800;
font-weight: bold;
font-size: 23px;
background:url('http://itsquad.us/wp-content/uploads/2014/06/tollfree1.png') no-repeat;
background-size:contain;
width: 500px;
height: 160px;
display:block;
}
.call p {
 padding-top:50px;
 text-align:center;
}
answered Jun 12, 2014 at 10:52

1 Comment

You copied his erroneous HTML, and kept it in your answer. you even used it in your codepen example.
-1

In the background URL, try to upload image in an uploading website (and paste the URL). Don't forget to make the height and width.

.yourCLASS{ 
 width: ?;
 height: ?; 
background: url(....);}
Dennis Meng
5,16214 gold badges35 silver badges37 bronze badges
answered Jun 12, 2014 at 22:27

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.