CSS - Assigning Div Position On The Fly
I have a container DIV a with absolute position containing DIV's b,c,d each with absolute position.
Code: <DIV class="a"> <DIV class="b"></DIV> <DIV class="c"></DIV> <DIV class="d"></DIV> </DIV> <DIV class="e"></DIV> DIV e has no asssigned position and is not displayed(floating in the background). I want to replace any of b,c or d (setting display to none) with e, displaying e in the position of either b,c or d. How do I assign the style of one DIV to another that is not its parent? I could if necessary place e inside a and do a swap, but I have quite a lot of DIV's like a, and would rather not have to repeat the code in each container DIV. Hope this makes sense! Similar TutorialsI have having issues with IE displaying my page wrong. The page is http://]http://tampabay-online.org/cetr/about.php (or any page within that site) and the css can be found at http://tampabay-online.org/cetr/cetr.css It displays fine in Firefox and Opera but IE makes the content class lower from the top than the #right navigation bar (they should both be 20 pixels form the top) Any help much appreciated. Code: .content { position:relative; width:320px; margin-left: 125px; margin-top: 20px; border:1px solid black; background-color:white; padding:10px; z-index:3; } #right { position:absolute; width:200px; top:20px; left:500px; border:1px solid black; background-color:white; padding:10px; z-index:1; } Hi people, I am completely new to programming and have only spent this weekend learning it! I have managed to create a decent website already, however i am stuck at a point. On my main page, i have attached a CSS stylesheet with all the formatting for my page. My problem however is that when i try to format one section (<div id="gallery">) the formatting messes with the rest of the page. Is there a way that i can assign a style sheet to only that <div id="gallery"> without it applying to the entire html page. Any help is greatly appreciated! Thanks Chris I have a loop in PHP that runs through sets of data and assigns positioning based on its place in the loop. For some reason the styles for position aren't being applied. Any ideas what i'm doing wrong? Code: <html> <head> <style> #wrapper {width:100%; height:100%;} #box {background-color:gray; width:100px;} </style> <body> <div id=wrapper> <div style="postion:absolute; left:50px; top:100px" id=box>AA</div> <div style="postion:absolute; left:100px; top:100px" id=box>BB</div> <div style="postion:absolute; left:150px; top:100px" id=box>CC</div> </div> Hi All... New to CSS, forgive my ignorence... I have started using CSS to assign classes to form elements, this works fine with input boxes but has no effect when assigning the same class to a dropdown listbox "<select>" - no change is apparrent in their appearance... Can anyone help please? Is this anything to do with 'contextual selectors'? If so how can I perform what i want to do? Sample of my code... Title: <select name="CUSTTITLE" class="formelements" > <option value="" <?php if (!(strcmp("", $form->value("CUSTTITLE")))) {echo "SELECTED";} ?>></option> <option value="Mr" <?php if (!(strcmp("Mr", $form->value("CUSTTITLE")))) {echo "SELECTED";} ?>>Mr</option> <option value="Mrs" <?php if (!(strcmp("Mrs", $form->value("CUSTTITLE")))) {echo "SELECTED";} ?>>Mrs</option></option> <input name="CUSTFIRSTNAME" type="text" class="formelements" size="15" maxlength="40" value=" <? if($form->value("CUSTFIRSTNAME") == ""){ echo $session->userinfo['CUSTFIRSTNAME']; }else{ echo $form->value("CUSTFIRSTNAME"); } ?>"> .formelements { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; color: #000000; margin: 1px; border: 1px solid #CCCCCC; } Any help would be appreciated. Thanks Arco Hi Everyone. I'm a new member and so please forgive me if I don't immediately understand all the jargon. However I have a problem and I was hoping someone might be able to help. I have searched the web and W3 schools but couldn't find the answer I was looking for. I am using strict HTML with an external CSS style sheet. I have a several paged website I am creating for part of a University assignment. I have several links which have 3 colours for 3 states. Link, visited and highlight. These work perfectly. (For me anyway). I have now been told to remove 'circular references'. I understand this to be; If I am on the 'Home' page, then 'Home' is no longer a link. (The cursor turns to a text bar instead of a hand) I have removed href from the html to stop this happening. leaving just <a>Home</a> This is fine, however, the colours that I specified in the css now no longer apply and the text is just black. I have followed the instructions in the web pages that I have seen to retain the colours, or add them to an inline style sheet, but nothing seems to work. I can only achieve adding one colour (but not making it change when visited or hovering) or changing the colour of ALL links. Sorry if this is confusing.. I hope someone can help! The relevent code is below. HTML <head> <style type="text/css"> .homebut a:link {color: red;} .homebut a:visited {color: purple;} .homebut a:hover {color: orange;} <!--none of the above seems to work--> </style> </head> <body> <div class="homebut"> <a>Home</a> </div> CSS /*This is applied to all links but doesn't work when I remove HREF from the HTML*/ a:link { COLOR: #0099FF; text-decoration:none;} a:visited { COLOR: #00FFFF; } a:hover { COLOR: #FFFFFF; } For a navigation I am using, I must use an li height to control spacing in IE6. I'm also using bullets to show a user where they are in the site by only having one bullet display at a time. Unfortunately, the height assignment I use on my li causes IE to misplace the bullet next to its secondary nav. Below is code I'm using to troubleshoot: Code: <ul><li><a href="#">dog</a></li> <li><a href="#">cat</a></li> <li class="here"><a href="#">fish</a></li> <ul> <li><a href="#">trout</a></li> <li><a href="#">angel</a></li> <li><a href="#">salmon</a></li> </ul> <li><a href="#">turtle</a></li> <li><a href="#">elephant</a></li> </ul> Code: li {height: 20px; list-style-type: none;} li.here {list-style-type: disc;} If a user is on the page fish, they will see that bullet point to page salmon. Any recommendations? Hullo, I have an issue here that I have been trying to find a solution for for the past week, but I suppose I don't really know what exactly to look for. I want to make a background that consists of different horizontal color strips. The reason I do not want to use an image and repeat it is because the strips are different in height. I want them to shrink/expand vertically keeping their proportion to each other ( instead of repeating vertically) in case the screen used to view the website is smaller/ bigger than mine. I tried creating different elements using <div id="name"> and assigning a background color and define a percentage for the height, however this doesn't work because the element has to have text inside it to expand according to it. I do not want to assign fixed heights because as I said I want them to expand and shrink proportionally. If you know a way to do this even if it is not CSS please let me know. All help is appreciated. Thanks. Hei ppl. i am begenning of designing in css but i have a problem.. i have my website www.zyxep.net/byensguf/ i have that div in the bottom under the text "footer" that <div> do i need to get over the header image to the right.. so the right side of the login field is flush with the right side of the border.. and i need it to stay on that position in every size of the users screen.. min. 800x600 max. anything.. here is my css code: Code: body { text-align: center; /* center things in pre-IE6 */ margin: 0px auto; } #container { margin: 0px auto; left:150px; top:0px; width:760px; height:420px; z-index:1; border-left: 1px solid black; border-right: 1px solid black; } #header { margin: 0px auto; left:0px; top:0px; width:760px; height:200px; z-index:2; background-image: url(images/logo.jpg); border-bottom: 1px solid black; } #menu { margin: 0px auto; left:0px; top:200px; width:760px; height:20px; z-index:3; border-bottom: 1px solid black; } #content { margin: 0px auto; left:0px; top:220px; width:760px; height:180px; z-index:4; border-bottom: 1px solid black; } #footer { margin: 0px auto; left:0px; top:400px; width:760px; height:20px; z-index:5; } #login { margin: 0px auto; left:760px; top:15px; width:400px; height:50px; z-index:6; } #username { width: 100px; background-color: transparent; border: 1px solid black; } #password { width: 100px; background-color: transparent; border: 1px solid black; } #loginsubmit { width: 100px; background-color: transparent; border: 1px solid black; } and my index.php Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>ByensGuf.dk - Byens bedste guf</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT="zyxep"> <META NAME="Keywords" CONTENT="zyxep, zyxep.net, portfolio"> <META NAME="Description" CONTENT="zyxep.net - portfolio"> <meta name="REVISIT-AFTER" content="1 DAYS"> <LINK REL="stylesheet" HREF="style.css" TYPE="text/css"> </head> <body> <div id="container"> <div id="header"></div> <div id="menu">menu</div> <div id="content">content</div> <div id="footer">Footer</div> <div id="login"> <form action="login.php" method="post"> <div> <input type="text" name="username" id="username"> <input type="password" name="password" id="password"> <input type="submit" value="login" id="loginsubmit"> </div> </form></div> </div> </body> </html> plz help me.. i am so confused Hello, I am having trouble understanding the positioning within CSS. I.E. the relative/absolute positions. I am creating a site with 1 banner and 2 columns underneath, all centered. The 2nd column I want to be right beside the left coumn. so it simply goes like So depending on where left is on the page, the main is always literally right beside it. Anyone have any suggested reads on this? How to make div stick to top of a page and align center The question is "What is the positioning context of a div positioned absolutely (e.g., div#nav{position:absolute;}); that is, where is the 0,0 coordinate from which any offsets will be measured?" Is the answer "it will be measured from the top left"? My site is RegionalCreations.com if you want to see the issue for yourself. I actually haven't encountered this issue before with the countless sites I've made. I used the basic layout of an already made wordpress theme and redesigned it for my site, I didn't change the menu position however, so I think the issue is with the original theme. Here is an image showing the problem: Well apparently I can't post an image so go to my site and then add /images/IE-CSS-bug.jpg on to see it, thanks. As you can see my image across the top is off center in IE even though it looks fine in Firefox. My menu is also spaced down in IE when it shouldn't be. Here are the locations of my stylesheets, the second 1 loads after the main 1 if you view the page in IE. (I can't post the url so go to my site and add the rest of the url on.) Stylesheet: /main/wp-content/themes/cleanmachine/style.css IE additional style: /main/wp-content/themes/cleanmachine/ie-win.css If anyone can look at my stylesheets and tell me the problem that would be great. Thanks. ok, so this is driving me insane right now. I have a page, all divs, all positions absolute. Everything is working perfectly except two divs, which should line up 157px from the top, do so only in firefox, safari and netscape, and for some reason they are 8 pixels off in IE. If I change the position to 149px, then it lines up perfectly in IE, but 8 pixels too high (and then of course behind other stuff in firefox, etc.). Here is the SITE, and here is the CSS If someone could please help me out here, I would be overwhelmingly grateful. Thanks in advance for any help anyone can offer. Hi all, im having a css scrollbar within a table and on refresh of that page,i want 2 position the scroll,at the end of the table. By default the scroll is always at the top. But how do i refer to the scroll position,to bring it to the end of the table? I am working on a website for a friend aamcokc.com and the Nav Bar is sitting right where it's supposed to in FF, Chrome, and Safari on the mac. However, the PC platform seems to make it sit to the left on some of the different browsers, but not all. Is there some kind of code fix I can put in the css to adjust for this? Sorry, this is my first attempt at CSS, so it may be a bit of a mess! Once I fix this issue the site is done, so the sooner the better!! I really appreciate any help anyone can offer!! I'm trying to position a DIV on the right bottom side of the page using the following code: position:absolute; right:0; bottom:0; Unfortunately when I scroll down the page, the div remains in it original place :-( I am trying to position the background image of a td with a random x value. I was trying to call a js randomizing function, had no luck. Is there any way to do this? Heres what I have, I need that -125px value to be random. .bg2 { background: url(testbg1.jpg) repeat -125px 0px; } If I do something like this: .divSubHomeRtPhoto { position: absolute; left: 340px; top: 167px; width: 420px; height: 420px; } Then <div class="divSubHomeRtPhoto"> my left and top positions don't seem to take in IE 5.2 for Mac. This seems to be fairly well known, from what I read on the internet. What this means for me though, is that I have to almost do away with positioning through CSS if I want my pages to work with IE 5.2 Mac, whcih I recently discoverd I do want to work. How do other cross browser CSS writes deal with this problem? Thanks for your help CJB |