...

View Full Version : inline img href drops a line in firefox



chazfort
01-06-2008, 06:08 PM
Hey folks,

I have a series of news pieces, each of which is followed by a small arrow that users can click to get to the article. The arrow is an html image added as part of a <p> and an <a href>. In CSSEdit the arrow lines up with the last line of the text. In Safari it does the same. In Firefox (2.0.0.11) it moves down a line. Any ideas why?

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Home Page | Institute for Sustainable Living, Art &amp; Natural Design [ISLAND]</title>
<link rel="stylesheet" media="screen" type="text/css" href="errortest1.css" />

</head>

<body>

<div class="testcontainer">
<a href="newsletters.html"><img src="newsletters.png" alt="newsletters" /></a>

<h1><a href="newsletters.html">ISLAND Newsletters</a></h1>
<p>Check out our archive of past newsletters and subscribe to receive monthly emails and/or biannual print news (it's free!)<a href="newsletters.html"><img src="littlearrow.png" alt="[GO]" /></a></p>

<div class="spacer"></div>
</div>

</body>
</html>

CSS:

h1, p {
font-size: 100%;
font-weight: normal;
}

img {
border: none;
}

.testcontainer {
margin: 20px;
}

.testcontainer img {
float: left;
clear: left;
margin: 0 0 10px 0;
}

.testcontainer p a img {
width: 1em;
clear: none;
float: right;
margin: 0 1em 0 0;
}

.testcontainer p a:hover img {
background: #ccf;
}

.testcontainer h1 a{
font-weight: bold;
font-size: 1em;
margin: 0 0 0 20px;
}

.testcontainer p {
color: #333;
font-size: 1em;
line-height: 1.4em;
margin: 0 0 0 95px;
}

.testcontainer a:link, .newspiece a:visited {
color: #900;
text-decoration: none;

}

.testcontainer a:hover, .newspiece a:active {
text-decoration: underline;
color: #900;
}

.spacer {
clear: both;
}

Excavator
01-06-2008, 06:44 PM
Hello chazfort,
A link to a test site would be nice for this... or at least send us littlearrow.png.
Kind of hard to tell what's making it drop when we can't see it.

When you say "it moves down a line" do you mean it makes a line break or is the image the only thing that moves down?

Try giving littlearrow.png a class and position it with margins... maybe even float it?

chazfort
01-06-2008, 07:32 PM
Sure:

http://www.artmeetsearth.org/test/errortest1.html

the image stays one line below the text, rather than lining up evenly with it.

Thanks for looking!

CF

Excavator
01-06-2008, 08:32 PM
the image stays one line below the text, rather than lining up evenly with it.


Yup, that's exactly what you told it to do.

Try this instead - copy/paste into a new test.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Home Page | Institute for Sustainable Living, Art &amp; Natural Design [ISLAND]</title>
<style type="text/css">
html, body {
background: #ccc;
}
* {
margin: 0;
padding: 0;
}
img {
border: none;
}
.testcontainer {
width: 800px;
margin: 100px auto;
margin: 20px;
overflow: auto;
background: #66CCCC;
}
.testcontainer img {
float: left;
clear: left;
margin: 0 0 10px 0;
}
.testcontainer .go {
clear: none;
float: right;
margin: 0 1em 0 0;
}
.testcontainer .go:hover {
background: #ccf;
}
.testcontainer h1 a{
font-weight: bold;
font-size: 1em;
margin: 0 0 0 20px;
}
.testcontainer p {
color: #333;
font-size: 1em;
line-height: 1.4em;
margin: 0 0 0 95px;
}
.testcontainer a:link, .newspiece a:visited {
color: #900;
text-decoration: none;
}
.testcontainer a:hover, .newspiece a:active {
text-decoration: underline;
color: #900;
}
h1, p {
font-size: 100&#37;;
font-weight: normal;
}
</style>
</head>
<body>
<div class="testcontainer">
<a href="http://www.artmeetsearth.org/test/newsletters.html"><img src="errortest1_files/newsletters.png" alt="newsletters"></a>
<h1><a href="http://www.artmeetsearth.org/test/newsletters.html">ISLAND Newsletters</a></h1>
<p>
<img src="errortest1_files/littlearrow.png" alt="[GO]" width="20" height="20" class="go" /></a>
Check out our archive of past newsletters and subscribe to receive monthly emails
and/or biannual print news (it's free!)<a href="http://www.artmeetsearth.org/test/newsletters.html">
</p>
</div>
</body>
</html>

chazfort
01-06-2008, 10:30 PM
Allright! I'm not sure exactly why moving the image up a line in the html and changing the way that the CSS finds it worked, but it worked like a charm! Thanks!

Excavator
01-06-2008, 10:33 PM
Allright! I'm not sure exactly why moving the image up a line in the html and changing the way that the CSS finds it worked, but it worked like a charm! Thanks!

Floats come first. Before the content that is supposed to be next to them. The float has to make room for itself before the text gets there.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum