Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!


Sponsored Content

 

 
 

Photo
- - - - -

Css Image Positioning


  • Please log in to reply
6 replies to this topic

#1 qwerty

qwerty

    HR 10

  • Moderator
  • 8,295 posts
  • Location:Somerville, MA

Posted 27 October 2003 - 10:11 AM

Does anyone know of a good way to use CSS to position an image immediately to the right of a heading tag?

Right now I've got the image inside the <h1></h1>, and I'm not crazy about doing things that way.

#2 websage

websage

    WebSage

  • Active Members
  • PipPipPipPipPip
  • 362 posts
  • Location:Arlington, VA, USA

Posted 27 October 2003 - 10:53 AM

Place both the headtag and the image in different <div> tags and then apply appropriate positioning to each.

Hope this helps.

#3 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 5,886 posts
  • Location:Blackpool UK

Posted 27 October 2003 - 03:36 PM

put them in a sized <div> then use <img> tag before the <hn> tag and set float:right; for the <img>

div.whatever {
position:relative;
top:nnpx;
width:nnpx;
height:nnpx;
}
img.whatever {
position:relative;
float:right;
}

<div class="whatever">
<img class="whatever" src="imagepath" alt="">
<h1>Some text</h1>
</div>


Chris.

#4 qwerty

qwerty

    HR 10

  • Moderator
  • 8,295 posts
  • Location:Somerville, MA

Posted 27 October 2003 - 04:05 PM

Doesn't that mean that if I want the image to appear a given distance from the last letter, I'll need to resize the div each time I create a header, based on the length of the text?

#5 Craig B

Craig B

    HR 4

  • Active Members
  • PipPipPipPip
  • 215 posts
  • Location:Calgary, Alberta, Canada

Posted 27 October 2003 - 04:45 PM

<div id="tagline">
   <h1 style="display:inline;">Your Heading Here</h1>
   <img src="/path/to/image" />
</div>

That should do it.

cheers,
Craig

#6 Craig B

Craig B

    HR 4

  • Active Members
  • PipPipPipPip
  • 215 posts
  • Location:Calgary, Alberta, Canada

Posted 27 October 2003 - 04:53 PM

and if you want to place a set distance between the image and the text, wrap the img tag in a span and set padding. For example:

<div id="tagline">
  <h1 style="display:inline;">Your Heading Here</h1>
  <span class="leftPadding"><img src="/path/to/image" /></span>
</div>

and in your external style sheet add:
.leftPadding{padding-left:185px;}

cheers,
Craig

#7 qwerty

qwerty

    HR 10

  • Moderator
  • 8,295 posts
  • Location:Somerville, MA

Posted 27 October 2003 - 05:08 PM

That looks like it'll work. Thanks.

I've still got a ways to go before I get to that step, though. I'm trying to redesign the page to get rid of something like three levels of nested tables. Once I've got all the layers positioning properly I can get started on formatting the content.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users