Solved

How do you fix a logo image to the right side of the screen in css?

Posted on 2009-07-15
6
273 Views
Last Modified: 2012-05-07
No matter what the screen size is it possible to always align logo to the right, what is the best method of achieving this please.
0
Comment
Question by:adypips
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 16

Expert Comment

by:s8web
ID: 24862558
There are a few different ways to achieve this, however the method that will work depends on how your page is laid out. Can you post a link or a snippet?
0
 

Author Comment

by:adypips
ID: 24862642
Here is my code snippet,  would like Logo.jpeg to always be on the right hand side.. if poss I have tried absolute positioning but this alters depending on browser size so looks a little odd.  Help!!
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="UTF-8" %>
<!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>MySite</title></head>
 
<body>
 
<div id="container">
        <div id="header">
          
        <img alt="Plums" src="images/pic1.jpg" 
                style="width: 173px; margin-top: 8px"/>&nbsp; 
        <img alt="Tomato " src="images/tomato.jpeg"/><img alt="Skipping rope" src="images/srope.jpeg" /><img alt="NHS Logo" 
                src="images/logo.jpg" 
                style="top: 23px; right: 134px; position: absolute" /><img alt="Green Apple" src="images/apple.jpeg" /><img alt="Crackers" src="images/crackers.jpeg" /><img 
                alt="Strawberries" src="images/strawberries.jpeg" 
                style="width: 130px; height: 80px; "/><img alt="Toothbrush" src="images/toothbrush.jpeg"/>&nbsp;
            <br />
        <br />
 
<h1>Welcome to Adys Site</h1>
 
<p>Welcome to my site</p>
<p>more text</p>
 
 
 
</body>
</html>

Open in new window

0
 
LVL 2

Expert Comment

by:toymachiner62
ID: 24862746
You should really use CSS instead of styling your html inside the tags. But you'll need to change this:

<img alt="NHS Logo"
                src="images/logo.jpg"
                style="top: 23px; right: 134px; position: absolute" />

to this:

<img alt="NHS Logo"
                src="images/logo.jpg"
                style="top: 23px; right: 134px; float:right" />
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 16

Expert Comment

by:s8web
ID: 24862811
Actually, what you have should work if you close your tags (see snippet)  and id=container and id=header don't contain declarations that clash with your inline styles.
<!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>MySite</title></head>
<body>
<div id="container">
	<div id="header">
        <img alt="Plums" src="images/pic1.jpg" style="width: 173px; margin-top: 8px"/>  
        <img alt="Tomato " src="images/tomato.jpeg"/>
        <img alt="Skipping rope" src="images/srope.jpeg" />
        <img alt="NHS Logo" src="images/logo.jpg" style="top: 23px; right: 134px; position: absolute" />
        <img alt="Green Apple" src="images/apple.jpeg" />
        <img alt="Crackers" src="images/crackers.jpeg" />
        <img alt="Strawberries" src="images/strawberries.jpeg" style="width: 130px; height: 80px; "/>
        <img alt="Toothbrush" src="images/toothbrush.jpeg"/> 
	<h1>Welcome to Adys Site</h1>
        <p>Welcome to my site</p>
        <p>more text</p>
	</div>
</div>
</body>
</html>

Open in new window

0
 
LVL 2

Accepted Solution

by:
toymachiner62 earned 125 total points
ID: 24862828
To do it with CSS your code should like something like this

 <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="UTF-8" %>
<!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>MySite</title>
 
<style type="text/css">
 
#pic1 {
	width:173px;
	margin-top:8px;
}
 
#nhs {
	top:23px;
	right:134px;
	float:right;
}
 
#strawberries {
	width:130px;
	height:80px;
}
 
</style>
</head>
 
<body>
 
<div id="container">
        <div id="header">
          
        <img id="pic1" alt="Plums" src="images/pic1.jpg" />
        <img id ="tomato" alt="Tomato " src="images/tomato.jpeg"/>
        <img id="srope" alt="Skipping rope" src="images/srope.jpeg" />
        <img id="nhs" alt="NHS Logo" src="images/logo.jpg" />
        <img alt="Green Apple" src="images/apple.jpeg" />
        <img alt="Crackers" src="images/crackers.jpeg" />
        <img id="strawberries" alt="Strawberries" src="images/strawberries.jpeg" />
        <img alt="Toothbrush" src="images/toothbrush.jpeg"/>
            <br />
        <br />
 
<h1>Welcome to Adys Site</h1>
 
<p>Welcome to my site</p>
<p>more text</p>
 
 
 
</body>
</html> 

Open in new window

0
 

Author Closing Comment

by:adypips
ID: 31603896
This has sorted out this.

Many thanks,
AdyPips
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

630 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