We help IT Professionals succeed at work.
Get Started

Attach 2 background image using CSS or jQuery

sabecs
sabecs asked
on
346 Views
Last Modified: 2012-05-12
Hi,
I am trying to allow my buttons/link to cater for different text length.
I have created button images wider than they need to be and currently the images gets cut off on the right hand side.
Is there a way of attaching the right hand side button images to this so that the button does not appear cut off?

I hope this makes sense.

Thanks in advance for your feedback.

<html>
<head>
<title>Test</title>
<style type="text/css"> 
 
a.main_menu, a.main_menu:visited, div.main_menu{
	display: block;
	height: 40px;
	line-height: 35px;
	color: #666;
	width: auto;
	text-align: left;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	font-weight: normal;
	text-decoration: none;
	padding-left: 15px;
	padding-right: 15px;
	background-image: url(/images/test_button.png);
	background-repeat: repeat-x;
	margin-right: 1px;
	border: 1px solid #FFFFFF;
}

a.main_menu:hover{
	background-image: url(/images/test_button_ovr.png);
	background-repeat: repeat-x;
	color: #000;
}

 
 
</style>

</head>
<body>       


<table>
<tr>
        <td>
        <div  id='menu_parent1'><a class='main_menu' href='#'>Home Page</a></div> 
        </td>
        <td>
        <div id='menu_parent2'><a class='main_menu' href='#'>Our Strategic Partners</a></div> 
        </td>
        <td><div id='menu_parent3'><a class='main_menu' href='#'>Forms & Documents</a></div> 
        </td>
        <td>
        <div id='menu_parent4'><a class='main_menu' href=''>Contact Us</a></div> 
</td>
</tr>
</table>
</body>
</html>

Open in new window


test_button
test_button_ovr
test_button_ovr_rhs
test_button_rhs
Comment
Watch Question
Fixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE