Solved

Position an image on a web page so that it shows up the same on different screen resolutions.

Posted on 2011-03-09
4
314 Views
Last Modified: 2012-05-11
Hi

I have been struggling four a while now trying to learn how to float images on web pages.

I want to float an image so it over laps a little bit of the mainContent div and then run down through the footer. I have been able to use absolute positioning to get the imgae to stick to the bottom but how do I keep it from floating to far to the left or right?

Right now I have it working great on screens set at 1024 * 768 but go to any higher a resolution or use a widescren and it floats off to the left or right.

Site can be viewed here and if there is anything else I can provide just let me know?

http://davidsons.net/wp4derek/

thanks
Matt
0
Comment
Question by:mld4165
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 35092493
Typically what we do is create a 'div' that contains all of the content in a fixed width box, often called 'wrap' or 'wrapper'.  Then all of the content stays in that 'wrap' container no matter what size the screen.  Kinda like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!-- 
#wrap {width:940px;margin-left:auto;margin-right:auto;} 
-->
</style>
</head>

<body class="oneColFixCtrHdr">
<div id="wrap">
<!-- beginning of wrap -->

  <div id="header">
  <a href="mailto:Julie@fieldstoneaudio.com?subject=More information requested."> <img id="emailicon" alt="Email Julie at:" height="46" src="images/emaillogo.png" width="46" /></a></div>
<!-- end #header -->

  </div>

	<div id="container">
	<div id="mainContent">
    <div id="redtxt">
		<p>Nearly 15 years ago, I was persuaded to record a radio spot for my restaurant, The Melodeon. The response was overwhelmingly positive, and I’ve been happily doing voiceovers ever since.</p>
	</div>
    	<hr />
			<div id="rightContent">

    		<p style="font-size:large">My client list includes:</p>
			<dl>
            <dt>Lexmark International</dt>
			<dt>Rolex 3 Day Event</dt>
			<dt>Conair Spa Products</dt>
			<dt>University of Kentucky Healthcare</dt>

			<dt>Lexington Clinic</dt>
			<dt>Republic Bank</dt>
			<dt>Milestone Realty</dt>
			<dt>Nationwide Insurance</dt>
			<dt>State Farm Insurance</dt>
			</dl>

    		</div>
	<h1>My voice is the perfect choice for the following:</h1>
	<ul id="ulist">
	<li>Upbeat, high energy and persuasive for retail and automotive.</li>
	<li>Soothing and reassuring for on hold messaging and voicemail systems.</li>
	<li>Warm and compassionate for heath care and physician specialties.</li>
	<li>Interesting and informative for documentaries and narratives.</li>

	<li>Sweet and Southern for regional flavor.</li>
	</ul>
	<hr style="clear:both" />
	<div id="demoicon">
	  <a href="Sound/JulieReedDemo2010.mp3">
      <img id="demoicon" alt="Please click here to listen to my demo:" longdesc="Please click here to listen to my demo:" src="images/demobckgrnd.png" /></a></p>
	  </div>
    <div id="tealtxt">

 <p>My friends locally at Dynamix Audio provide me with state of the art production services; including an ISDN equipped studio with a Neumann U-87 microphone.<br />
  You can visit them here at <a href="http://www.dxaudio.com">www.dxaudio.com</a>.<br />
  Lucky to live in the beautiful Bluegrass area, I am also available to travel to your studio of choice.<br />
  Please contact me, <a href="mailto:&#074;&#117;&#108;&#105;&#101;&#064;&#102;&#105;&#101;&#108;&#100;&#115;&#116;&#111;&#110;&#101;&#097;&#117;&#100;&#105;&#111;&#046;&#099;&#111;&#109;">Julie C. Reed</a> for a prompt, cost effective quote on your next project!</p>

  </div>
  <!-- end #mainContent -->
</div>
<!-- end #container -->
</div>
  <div id="footer">
    <p>Put images and links here.</p>
  <!-- end #footer -->
  <div id="micro">
  <img src="images/microphone.png">

  </div>
  </div>
<!-- end of wrap -->
</div>

</body>
</html>

Open in new window

0
 
LVL 1

Author Comment

by:mld4165
ID: 35099540
DaveBaldwin: thanks so much. I see what i was doing wrong now.
0
 
LVL 1

Author Closing Comment

by:mld4165
ID: 35099542
Thanks for the advice and solution.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35100860
You're welcome, thanks for the points.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

822 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