Cheryl Lander
asked on
placing image to right of text
I have a div which has a heading for each section on a page.
how do I create a class which adds an image to the right handside (at the end of the text) of each heading.
here is the code for the currnet div
<h2>How The Building Centre can assist you</h2> (need image to go here)
div#content h2 {
background: #E8EFF3 center;
margin: 8px 0 0;
color: #FF7E00;
font-size: 12px;
text-decoration: none;
text-align: left;
vertical-align: middle;
padding: 5px;
font-family: Arial, Helvetica, sans-serif;
}
how do I create a class which adds an image to the right handside (at the end of the text) of each heading.
here is the code for the currnet div
<h2>How The Building Centre can assist you</h2> (need image to go here)
div#content h2 {
background: #E8EFF3 center;
margin: 8px 0 0;
color: #FF7E00;
font-size: 12px;
text-decoration: none;
text-align: left;
vertical-align: middle;
padding: 5px;
font-family: Arial, Helvetica, sans-serif;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi...
TRY THIS... Just copy, paste and execute...
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
.heading {
font-family: Thoma, Arial, Verdana;
font-size: 11px;
font-weight: bold;
color: #333333;
background-attachment: fixed;
background-image: url(image.gif);
background-repeat: no-repeat;
background-position: right center;
}
-->
</style>
</head>
<body>
<h2 class="heading">This is the heading</h2>
</body>
</html>
TRY THIS... Just copy, paste and execute...
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
.heading {
font-family: Thoma, Arial, Verdana;
font-size: 11px;
font-weight: bold;
color: #333333;
background-attachment: fixed;
background-image: url(image.gif);
background-repeat: no-repeat;
background-position: right center;
}
-->
</style>
</head>
<body>
<h2 class="heading">This is the heading</h2>
</body>
</html>
ASKER
Im basing the following on this code.
div#content
{
background: url("/someimg.gif") #E8EFF3 90% 30% no-repeat fixed;
}
Works fine but I can only see the image through <h2> when I scroll the page. Its almost like the background image is fixed and and that h2 is a window.
div#content
{
background: url("/someimg.gif") #E8EFF3 90% 30% no-repeat fixed;
}
Works fine but I can only see the image through <h2> when I scroll the page. Its almost like the background image is fixed and and that h2 is a window.
ASKER
All ok. it was affected by another div. thanks.
.right{
border:0px;
padding:20px;
float:right;
}
<h2>How The Building Centre can assist you</h2> <img class="right" src="images/image.jpg" alt="name"/>