473,385 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

CSS-positioning with top and bottom

Hi,
I want to create an element that starts 74 px below the upper border of the
browser window and ends at the bottom of the window.
I tried following code:

#test {
position:absolute;
top:74px;
bottom:0;
}

It works fine in firefox but in Opera and IE7 RC1 it seems to work only for
divs but not for images,
as it can be seen on this test page:
http://workflow.gopublic-solutions.de/test.html

Is it possible to format images with this css code without wrapping them in
divs?
Compatibility to IE6 an older browsers is not necessary.
Thanks in advance,
Simon
Aug 30 '06 #1
4 1539
"Simon Remppis" <S.*******@gopublic-solutions.dewrote:
>I want to create an element that starts 74 px below the upper border of the
browser window and ends at the bottom of the window.
I tried following code:

#test {
position:absolute;
top:74px;
bottom:0;
}

It works fine in firefox but in Opera and IE7 RC1 it seems to work only for
divs but not for images,
as it can be seen on this test page:
http://workflow.gopublic-solutions.de/test.html

Is it possible to format images with this css code without wrapping them in
divs?
"Wrapping" the image in a div won't help.

What you effectively are trying to do is alter the replaced element's
used value for height. Using positioning for that strikes me as bizarre.
The rules for a situation like that are here:
http://www.w3.org/TR/CSS21/visudet.h...eplaced-height
this refers to
http://www.w3.org/TR/CSS21/visudet.h...eplaced-height
note that an image has an intrinsic height

If I read that correctly then the used value for height should be the
image's intrinsic height, that would make Opera's rendering correct.

It is difficult to advise on how to achieve what you want since you
appear to be doing something very strange. More info on what you are
actually trying to achieve is needed.

--
Spartanicus
Aug 30 '06 #2
Hi

"Spartanicus" <in*****@invalid.invalidwrote:
"Wrapping" the image in a div won't help.
I tried it and the surprising result is, that wrapping the image in the div
leads to the intended behaviour in Firefox and Opera but not in IE:
http://workflow.gopublic-solutions.de/test.html
What you effectively are trying to do is alter the replaced element's
used value for height. Using positioning for that strikes me as bizarre.
The rules for a situation like that are here:
http://www.w3.org/TR/CSS21/visudet.h...eplaced-height
this refers to
http://www.w3.org/TR/CSS21/visudet.h...eplaced-height
note that an image has an intrinsic height
Thank you for these resources. If I read them correctly, implicitly defining
the height of an object by setting values for top and bottom works, but only
if the element has no intrinsic height. If an element has an intrinsic
height, the given value for bottom is ignored and replaced by the given
value for top plus the intrinsic height.
It is difficult to advise on how to achieve what you want since you
appear to be doing something very strange. More info on what you are
actually trying to achieve is needed.
Ok, I'm sorry for that. What I'm trying to achieve is a vertical shadow,
that starts 74 px below the upper border of the browser window and ends at
the bottom. I originally tried to do this with an image that has a height of
1 px and is dynamically stretched to the necessary height. But as this works
only in Firefox, I'm now going to replace the img tag with a div tag, that
uses the image as background and repeats it along the y-axis:
http://workflow.gopublic-solutions.de/test2.html
This seems to work in all newer browsers.
Thank you again for your help,
Simon
Aug 31 '06 #3
I find a solution for your problem. It ran in IE5.0/6.0 and Firefox
1.5. For other browser i don't know.
I use margin and height and i delete the scroll with the overflow
property. I don't know if is correct but it run.
The code is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLELine </TITLE>
<style>
*{
margin:0;
padding:0;
}
body{
height:100%;
overflow:hidden;
}
#line{
margin-top:74px;
background:url(shadow_right.png) repeat-y;
width:8px;
height:100%;
}
</style>
</HEAD>

<BODY>
<div id="line"></div>
</BODY>
</HTML>

I hope that i help you. Sorry for English.

Aug 31 '06 #4
Hi, i have find a solution at your problem with javascript and css:
These is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLEOther time </TITLE>
<style type="text/css">
*{
margin:0;
padding:0;
}
#header{
height:72px;
width:100%;
background-color:#ccc;
}
#line{
position:absolute;
left:10%;
top:72px;
width:1%;
background:url(shadow_right.png) repeat-y;
}
#content{
position:relative;
left:11%;
width:89%;
}
#content #padding{
padding:5px;
}
#footer{
height:20px;
background-color:#ccc;
text-align:center;}
</style>
<script>
function setHeight(line,content){
absolute = getElemRefs(line);
relative = getElemRefs(content);
absolute.css.height = relative.offsetHeight + 'px';

}
function getElemRefs(id) {
var el = (document.getElementById)? document.getElementById(id):
(document.all)? document.all[id]: (document.layers)?
document.layers[id]: null;
if (el) el.css = (el.style)? el.style: el;
return el;
}
</script>
</HEAD>

<BODY onload="setHeight('line','content')">
<div id="header">TITLE</div>
<div id="line"></div>
<div id="content">
<div id="padding">Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text Here there is some text
Here there is some text Here there is some text </div>
</div>
<div id="footer">Made by Mauro Bertani</div>
</BODY>
</HTML>

Sep 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: andy johnson | last post by:
Hi All, I called an external stylesheet main.css, created the html files and checked them locally OK. I uploaded everything to the server. When I checked it, the connection kept crashing. I...
1
by: Jocab | last post by:
Just had a look at the Wired.com site and it seems it's completely in XHTML and CSS. I don't understand this snippet of code on their homepage, though: <link rel="stylesheet" type="text/css"...
145
by: Mark Johnson | last post by:
Oddly enough, I found it difficult, using Google, to find a list of best-of sites based on the quality of their css packages. So I'd ask. Does anyone know of particularly good sites which are in...
36
by: Peter Brause | last post by:
Hello, my stylesheet shows different colors for visited, active and hovered links. It works fine in IE 6, but in Opera 7 the color for the active link (red background) is never shown. How to...
48
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html ...
4
by: g | last post by:
I'd like to have a CSS file for everything that's common to my site, and other CSS files that are specific to certain pages or groups of pages. When a page loads, it would load in BOTH the General...
7
by: Nilesh | last post by:
I am using background-image attribute in a CSS file and linking the CSS file to aspx page. But strangly, background-image attribute is not working for relative URL. e.g. If I apply following css...
3
by: nick | last post by:
I have the following code in my master page: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
4
by: Mikaël PLOUHINEC | last post by:
Hello, I have created a master page with a css. How can I use css in the children pages? The css must be declared in the <head</headsection. Does I have to import all my css in my master? Is...
1
by: matz2k | last post by:
I've got a big problem with the CSS layout which I've produced with Photoshop/Dreamweaver especially for my ebay auctions. This is what it looks like...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.