May 16, 2008

Looking For A Fix To Use "fixed" Positioning In Ie

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > CSS (Cascading Style Sheets)

free web hosting

Looking For A Fix To Use "fixed" Positioning In Ie

shadowx
Hi all

I'm trying for the first time to use JS to modify styles and such and part of my design is to have a DIV appear in the middle of the browser's window, so to do this, and keep the DIV in the middle even while scrolling ive used the FIXED positioning style with CSS, now i develop in FF so as soon as i toggle to IE, version 6.x, i suddenly see that my DIV is just stuck at the top not where it should be and not FIXED either. After some research i find that FIXED doesnt work in IE less than version 7, now i could just upgrade to IE7 despite my reluctance but then the issue is, if i were to fully develop something like this for a real website, would *all* of my visitors, or at least 99%, be using IE7 or FF or Netscape, which should then be able to view the DIV correctly?

Im thinking no... so thats why i want a fix for this issue, ive looked on the web and seen a few including using JS to move the DIV in relation to the scrolling thats going on, but thats really jerky and i think its more complicated. Ive also seen a CSS fix for it too, but again it seems a little complicated and the thing is the solution involves "tricking" IE into using ABSOLUTE instead of FIXED to get the same effect which then renders ABSOLUTE useless for anything other then emulating the FIXED effects, and that isnt very desirable.

Are there any other solutions? I dont mind upgrading to IE7 if i have to but then im worried that my users wont have IE7 or FF or NS which are able to display it correctly.... Why cant everyone just abandon IE?! mad.gif

 

 

 


Reply

jlhaslip
Stu Nicholls / cssplay.co.uk to the rescue (again)...

http://www.cssplay.co.uk/layouts/fixed.html#bites

Enjoy!

Reply

shadowx
I did see this particular website but the thing that stopped me is this line:

QUOTE
The only problem with this is that you cannot use absolute or relative positions on the moving page but float is allowed


And i use ABSOLUTE positioning, but i tried it anyway and it didnt work, im not sure why, i views the source of that page and copied the CSS that related to the div "menu" as that is the "FIXED" one and i also saw some HTML code within comments that related to CSS so i copied that too and it didnt work. Im wondering if it has anything to do with the fact that im using an external CSS file and they are using the CSS within the HTML? I dont think it would make any difference.

The Relevant CSS is below. The Div im trying to format is classed "submit", if you could shed any light on the problem it'd be great!

CODE
div.submit {display: block; border-width: 3; border-style: Solid; border-color: blue; background-color: #55AAFF; width: 555; position: fixed; top: 35%; Left: 25%; padding: 5;}

* html #submit {position:absolute;}

body {border:0; height:100%; overflow-y:auto;}


Im not massively experienced in CSS so im not sure what the hashes and asterix means either.

 

 

 


Reply

jlhaslip
maybe attach the entire page code to a posting for review.

Reply

shadowx
Okies, ive attached both files with this post.

This is a real pain in the... that IE cant do something right for a change!

Merge my posts if it seems more convenient, it just seemed easier to do it this way

Reply

jlhaslip
QUOTE
This is a real pain in the... that IE cant do something right for a change!


why would they start now???

Reply

bishoujo
I'd need some advice on this too. I was always having problems with the absolute positioning in IE! My frames site would look perfect in Firefox but when I test it in IE, it'll look distorted. Wish everyone would just use Firefox.

Reply

jlhaslip
The Tutorial at cssplay was pretty clear about what to do, I thought, but here is your page back. have (literally) 'fixed' the problem... heeheeheeee!

CODE
<!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>

<script language="Javascript" src="ajax_begin.js" type="text/javascript">
</script>
<title>
DB CMS V O.O1
</title>
<style type="text/css">
/*<![CDATA[*/
body {border:0; height:100%; overflow-y:auto;}
#submit.submit {display: block; border-width: 3; border-style: Solid; border-color: blue; background-color: #55AAFF; width: 555; position: fixed; top:25%; Left: 25%; padding: 5;}

div.reset {border-width: 1; border-style: solid; font-style: underlined; width: 155; padding: 2; text-align: center;}
/*]]>*/
</style>
</head>
<body>

<div id="submit" class="submit" width="255">
<br />
The details you specified are now being checked and saved to the database. Please stand by for further instructions or confirmation.<br />
<br />
</div>
<form action="add_page.php" method="get" name="details" id="details">
<br />
<br />

Page Title: <input type="text" id="title" /><br />
<br />
Module Name: <input type="text" id="module_name" /><br />
<hr />
<br />
HTML Content<br />
<textarea id="content" rows="35" cols="95">

</textarea>
</form><br />
<br />
<button onclick="ajaxdelay();">Save</button><br />
<br />
<br />
<br />
</body>
</html>

I included the css with the page so I didn't need to post both of them. Might want to separate them again. Cleaned it up a little, too. Notice that I have added a Doctype at the top, too. VERY IMPORTANT that you have a proper Doc Type on your page. Make the Browsers behave, not the same, but predictably.

If you want to use this code again, use a "named" div submit, of the "class" submit. The Named div is the hash sign (#) and a class is the period (.), so this css code will 'freeze' anything that is selected as id="submit" and class="submit" on your page.

You can benefit from this sample code by learning to use Floats, Margins and padding to position elements on your page instead of position:absolute. It works, but is difficult to deal with across the different browsers. Until you understand the w3c Box Model, try to avoid position:absolute.

Reply

shadowx
Thanks for that Jlhaslip! I always forget the doc types and i really should use them, i remember they played an important part in my last CSS related problem too dry.gif

Ill look into the margins and padding styles and floats, i thought i new enough CSS to get me through but perhaps not!

Thanks for all the help!

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : fix, fixed, positioning

  1. Site Error For Php Pages
    Needs to Be Fixed Immediately (6)
  2. Gallery Fixed.
    (3)
    The Gallery in the forums did not have enough permissions. I have reset them and you should now be
    able to post images to gallery. Let me know if there are any issues.....
  3. Having A Fixed Layout.
    (8)
    I know how to make HTML/CSS Layouts, but I was wondering if someone could tell me how to have it
    fixed. An example of what I'm looking for is on www.elitemafia.net when you have logged in.
    Any help greatly recieved.....
  4. Qupis Hosting Module Errors. Fixed Now!
    (0)
    Hi Members, We had some module ERRORS yesterday as a result, There was a brief downtime. The ads
    were not being displayed properly and some members reported duplicate ads. The errors have been
    fixed. Within this span, any accounts which were ordered might have hosting activation problems. We
    estimate around 6-7 accounts with these errors. We are extremely sorry for the inconvenience.
    Thank You....
  5. Boinc - Donate Your Excess Cpu Calculations For Science
    [fixed name in Topic title] (4)
    I leave my computer on all the time and it just sits there useless. I figured it could be used for
    something good and found boinc, where you can have your cpu calculate for different science projects
    when you're not doing anything on it. It can search for extraterrestrial intelligence, help
    decode genomes, help map out the most efficient way to prevent malaria or many others. Try it out
    and help the world without any effort, what easier way to give yourself that warm fuzzy feeling.
    I've already gotten 881 blocks processed for Seti and still working at finding ali....
  6. Recent Cpanel Upgrade (FIXED)
    May affect the application process (7)
    Due to the recent upgrade in the Cpanel used for the Hosting accounts and its ability to integrate
    the information provided by the Approval script, there has been a pause in the Approval process for
    the new Hosted Account Applications. Please be patient as the Admins sort it all out and be
    assured that their best efforts are being directed in correcting the script/cpanel conflicts.
    Thank you for your patience. ....
  7. My Laptop's Mousepad Won't Work, Can It Be Fixed?
    (4)
    My laptop's mousepad won't work what ever i do on the mousepad the arrow just stay
    still...however if i connect a USB external mouse the arrow will move as usual. So is this easy to
    fix? can i fixed it by myself? how can i check what is its problems? any one have any idea please.
    Thank you!....
  8. Ie6 Relative Positioning Bug
    how to avoid (1)
    i have the following definition in my style and i'd like all elements in site to be relatively
    positioned against their parents so i can position any of them absolute when i need to: CODE
    {     margin:0; padding:0;           font-family:verdana,arial,sans-serif;     
    font-size:11px;      text-align:left;      background:none;      color:black;     
    position:relative;     } All good in opera9 and FF2beta but IE6 stills the page without the
    possibility of scrolling it down. Any ideas?....
  9. Windows 98se Computer Has Messed Up And Won't Load
    Problem fixed now, please disregard this topic. (13)
    Ok, I got a problem. Recently, an old Windows 98SE computer my friend has, messed up. All the DOS
    programs that were on the computer, started claiming that they were out of memory, and after he shut
    it down, he went on it later only to find that he cannot load Windows because there is "Insufficient
    Memory to Initialise" it! There is nothing wrong with the hard drive, however - I tried to use
    Safe Mode on his computer recently and it worked fine (with some restrictions, of course). I
    personally think it could be a problem with how much Virtual Memory has been allowed....
  10. Fixed Problems, Back
    Hey (4)
    Its been a long long time, now all of a sudden i can access trap17.com YIPPIE! The Spam Patrol
    man is back yes /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif"
    />....
  11. Mysql Error-fixed
    This happened only 10 minutes ago! (3)
    Warning: mysql_connect(): Can't connect to local MySQL server through socket
    '/var/lib/mysql/mysql.sock' (2) in /home/cinnamon/public_html/index.php on line 7 Warning:
    mysql_select_db(): Can't connect to local MySQL server through socket
    '/var/lib/mysql/mysql.sock' (2) in /home/cinnamon/public_html/index.php on line 8 QUOTE
    Warning: mysql_select_db(): A link to the server could not be established in
    /home/cinnamon/public_html/index.php on line 8 Warning: mysql_query(): Can't connect to local
    MySQL server through socket '/var/lib/mys....
  12. Problems With Webpage Positioning In Internet Explorer
    (11)
    Originally this topic was asking for testing of my page in Internet explorer but someone on another
    forum got there first, but I still need help! I've made a page using absolute positioning
    and php, using percentages for positions so that it should suit all screen resolutions. However on
    internet explorer some of the text on the right can't be seen and is off the page, whereas in
    every other browser it's perfect. What can I do to make it show up properly in internet Explorer
    as well as all the other ones? Here's the link so you can see what I mean by....
  13. Css Positioning Trouble
    in FIREFOX! yet IE displays it as i want (6)
    Wait wait! im not complaining about firefox! i couldnt ever do it, but the fact is that for
    the very darn first time IE is actually showing the thing as i want it... I have a table inside a
    div, and i want the table to be right aligned, and IE6 does so (not the same for ie for mac though)
    but firefox keeps it to the left, the best thing i've achieved with this is a fixed position
    which does not look good while resizing...... ive also tried floating and even adding a wrapper...
    so i dont know what to do... this is the site: http://www.cucea.udg.mx/cucea/gr....
  14. Positioning
    (3)
    I want to be bale to poistion certin parts of my code in specfic places. I need to be able to
    disaply this quickly. As a temp measure I have started and stopped php tags. Now normally this will
    disaply a php block on my dreamweaver. However it is not. Is there a reason why?? My code is; PHP
    Code: CODE <?php     $db = @mysql_connect
    ("localhost","root","andy");         print "Database
    Connection gained";     echo '<br>';        
    mysql_select_db("disertation",$db);     ....
  15. Fixed Background Image
    Just little reminder (10)
    Easy teahnic, post the following codes between and QUOTE <!--
    body{background-image: url( under.gif ); background-repeat:no-repeat; background-attachment :
    fixed; background-position: 10% 20% ;} --> For red colour, change it to your
    image's location. For green colour, it is used to set horizontal and vertical position of
    background image. I hope it can help you. /tongue.gif' border='0' style='vertical-align:middle'
    alt='tongue.gif' /> ....
  16. Centered Website With Fixed Width
    ...begginers lesson... (2)
    This will be tutorial on how to make a simple website design with fixed width and center position.
    This is actually rather simple tutorial, but hopefully it will help others that are new in world of
    creating websites. Website will also contain header, content area and footer. First we must do
    Wrapper. Wrapper is actually an area of fixed width and will be position into center, so that our
    page doesn't fall apart. CODE body{ width:100%;  margin:0px;  padding:
    0px;  text-align:center; background:#FFFFFF; } This is actually an IE....
  17. Anyone Want To Do A 'small' Code For Me?
    I need my links at my site fixed. (9)
    www.gigapass.trap17.com You see the links at the top? I need those to have maybe a backround that
    reflects the users current theme sidebar color, and I need them to be spread out left to right. I am
    currently trying to learn php, so I have no idea where to start/what to do.....
  18. Server fixed?
    (2)
    Sorry if I'm behind or something. I recieved an email saying free hosting is back.(I only joined
    recently and was affected by the apache server issues) I wasn't sure if it was back up or not based
    on posts. I do see that a lot of topics are gone and a lot of stickies with only a few psots that
    have been made lately in them. As before Cpanel and ftp work for me, but I would have to change my
    nameservers to see if the servers are back up for me so if you could let me know that would be
    great. Sorry if this was already asked.....
  19. the problem in the servers will be fixed?
    (1)
    sometime?....
  20. bug fixed,my site working
    (5)
    Server is working thank admin....
  21. Admin...Is the BUG fixed?!?!
    (8)
    Admin, I see that you are now accepting requests for free hosting now, but I still cant upload,
    fantastico opens, but there are errors: Warning:
    fopen(/home/unitedva/.fantasticodata/phpLinksFix): failed to open stream: No such file or directory
    in /tmp/cpanel.unitedva.1105807588.9522 on line 500 Warning: fwrite(): supplied argument is not a
    valid stream resource in /tmp/cpanel.unitedva.1105807588.9522 on line 501 Warning: fclose():
    supplied argument is not a valid stream resource in /tmp/cpanel.unitedva.1105807588.9522 on line
    502 Warning: fopen(/home/unit....
  22. German Soccer Games Fixed!
    (0)
    Hi WoW!!! This is a big stunner. A referee of the bundsliga has been fixing games in
    order to let high bidders win and get some money himself. It all came to light when a game between
    hamburg and another team which I forgot was tied at 2-2 and that other team got two penalty kicks
    awarded that were nonexistant. Also a Hamburg player was sent off. The referee has admited to
    everything and is cooperating. Heads are gonna roll. Germany didn't need that before to host the
    next world cup. One crooked referee is going to ternish the german soccer federation r....
  23. Simple Smil Question About Image Positioning
    (3)
    Howdy all, I'm working on a project for college but ran into a "little" problem with SMIL,
    concerning positioning images. You can see the smil presentation here:
    http://www.ket.trap17.com/smil-show/index.html (its only a 15 second presentation and doesn't
    take long to load. don't mind the language on the left image, its portuguese) What i want to
    do, is to make the image on the right, to fade in in the same place as the left image. I tried
    setting a region but that didn't work, I tried using the layout tags in the but that also
    didn't work (o....
  24. Hosted Members Access Rights Most Be Fixed
    (3)
    HOSTED MEMBERS ACCESS RIGHTS MOST BE FIXED, SOME THINGS MEMBERS CAN DO HOSTED MEMBERS CANT DO....

    1. Looking for fix, fixed, positioning

Searching Video's for fix, fixed, positioning
advertisement



Looking For A Fix To Use "fixed" Positioning In Ie



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE