Solved

placing image to right of text

Posted on 2007-04-10
5
250 Views
Last Modified: 2010-07-27
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;
}
0
Comment
Question by:Cheryl Lander
5 Comments
 
LVL 8

Accepted Solution

by:
sankarbha earned 500 total points
ID: 18880765
Try this.  You can adjust the position of the image to right by changing the percentage values.

div#content
{
      background: url("/someimg.gif") #E8EFF3 90% 30% no-repeat fixed;
}
0
 
LVL 24

Expert Comment

by:Alan Henderson
ID: 18880878
Or create a class like this:

.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"/>
0
 
LVL 8

Expert Comment

by:jawahar_prasad
ID: 18880927
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>
0
 

Author Comment

by:Cheryl Lander
ID: 18882039
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.
0
 

Author Comment

by:Cheryl Lander
ID: 18882050
All ok. it was affected by another div. thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
form button worked now it doesnt anymore 9 36
highcharts wont fix inside a bootstrap modal window 6 25
HTML Relative path 9 28
Change javascript css 1 16
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now