CSS - Style Attribute In Css
Hi people,
What is the equivalent of this div style attribute in css? <div style="overflow: hidden; position: absolute; left: 0px; top: 0px; width: 500px; height: 300px"> Its the overflow what I'm looking for. -just edited this that I have the solution sorry beginners corner Similar TutorialsI am trying to retrieve the color and background attributes of a CSS class defined in a .css external file. I would like to retrieve the attributes in a JavaScript function, given the class name. I am trying to invert the colors of a table cell background and hyperlink text. --begin style sheet-- table.submenu { background:#66CCFF; position:absolute; visibility:hidden; font:8pt Arial; font-weight:bold; color:#FFFFFF; text-decoration:none; } a.menulink:link,a.menulink:visited,a.menulink:active { color:#FFFFFF; text-decoration:none; font-weight:bold; } --end style sheet- --begin javascript-- function invertmenu(elmntID,elmntClass) { //the first two lines of code do not work var textColor = elmntClass.style.color; var backColor = elmntClass.style.background; document.all[elmntID + "link"].style.color = backColor; document.all[elmntID].style.background = textColor; } --end javascript-- --begin html code-- <tr><td class="submenu" id="techdept1" onmouseover="invertmenu('techdept1','submenu')" onmouseout="invertmenu('techdept1','submenu')"><a href="t40/default.asp" class="menulink" id="techdept1link">T-40</a></td></tr> --end html code-- thanks for your help! - tim Can someone tell me why css style settings for links won't effect a mailto: link? Is there anyway to make it happen without individually coding style into each mailto: link? Thanks, HeadElf For reasons of compliance with the SEC, I can't use cascading style sheets, but rather, I have to generate style attributes for each individual element (e.g.
Code: <p style="width:436pt; margin:0pt; padding:6pt 0pt 0pt 20pt; font-family:serif; font-weight:normal; color:#000000; font-size:10pt; text-align:left; font-style:normal; line-height:12pt; background-color:#FFFFFF;" >text </p> don't get me started on how rediculous this is). Its stupid, but it works. What I can't figure out is how to apply something like Code: <style type="text/css" media="print"> hr {visibility:hidden} </style> to <hr style" ??? "/> any suggestions would be much appreciated -LG I am just wondering if there is a way to simply extend a style rule from one previously defined. For instance, if I have this rule: Code: .textarea-box { color: #990000; background-color: #fff; width: 375px; height: 200px; border: #000 solid 1px; } ...if I want another text area rule to be the same except for one difference, the height should be 80px, do I have to write the rule out again with a new name, incorporating the new height, or is there some nifty way to just change the height in the new rule? Thanks for help with this. j9 I have a menu bar made up of <a href> elements that have a hover style of:
PHP Code: #mainMenu a:hover { color:#000000; background-color: #66c74c; padding: 1px 4px 1px 4px; margin: 1px 1px 1px 1px; } This will provide a green colored rollover visual as the user moves their mouse over the menu bar. I just added some JS today that will highlight the clicked (selected) menu so there is visual feedback of the section the user is in. For some reason, after setting the background color of the <a href> and color attributes, the HOVER: no longer functions. Here is the code to do the hilite where I pass the ID of the <a href> menu selection in the variable "menu": PHP Code: //--- Simplify setup by creating an array of the menus and hilight ID's --- var menus = ["menu1","menu2","menu3","menu4","menu5", "menu6","menu7","menu8","menu9","menu10"]; function J_hiliteMenu(menu) { //--- first make sure all the menu are hidden and unhilited --- for(i=0; i < menus.length; i++) { if (menus[i] == menu) theIndex = i; // Hold on to the chosen index position var obj = document.getElementById(menus[i]); if (obj == null) continue; // if menu is not available skip it obj.style.color = "#ffffff"; obj.style.backgroundColor = "#234fd7"; } //--- hilite the menu we're interested in --- var obj = document.getElementById(menu); obj.style.color = "#000000"; obj.style.backgroundColor = "#f8f400"; } Prior to hiliting the menu I un-hilite all the menus (since we may be switching from another). I think this is where the problem is. Maybe I need to redefine the rollover "hover" attribute for all elements during the un-hilite loop? Does anyone know how to set a HOVER: attribute using JavaScript? Thanks! Attempting to inherit all main attributes of a column, and modifying few, what is the correct way to inherit/overwrite the attributes of col3 here ? Code: .col3, col3b { float: left; position: relative; background: #FFFFFF; width: 25%; height: 80%; left: 3%; border-left: 1px solid #333; margin: 3px 2px 4px 0; } .col3b { border-left: none !important; } Tried as well like: Code: .col3 { } .col3 .col3b { border-left: none !important; } note: not talking about a single 'inherit' value I want to set a width for a div so that its left hand edge is at the left edge of the viewing window and its right hand edge is at a particular location in a centered layout and retains that width (ie it stretches) when the window is resized. A percent width will not achieve this. Can anyone explain how it can be done? I'm using frames and I want all my anchors to launch in a separate frame. Right now I'm doing: Code: <a href="http://example.com" target="MAIN">example</a> Can I put something in my stylesheet that will automatically launch all links in the "MAIN" frame? Thanks. <div type="test"> I am interested in the type attribute. The reason is this... I have a Janus GridEx on my asp.net form and I want to add some css styles to it. There is no ID defined, nor a class of which I can inherit. I can't modify the code for this tag so I was hoping I could use the type attribute to identify this div in my css.... This is the code for the DIV I'm talking about: Code: <div type="4" style="position:relative;padding:0px 0px;width:100%;overflow-x:auto;overflow-y:auto;"> Anyone has any experience with this? Thanks! Having a little trouble. I'm creating a horizontal nav menu with a bg image for each li, but can't seem to get the height set for the li in css. Using this code: Code: nl#navBar { margin: 0px; padding: 0px; font-family: Arial, Helvetica, sans-serif; } nl#navBar li{ list-style-type: none; display: inline; } nl#navBar li a:before { content: url(../images/navbutton_left.gif); } nl#navBar li a:after { content: url(../images/navbutton_right.gif); } nl#navBar li a{ text-decoration: none; background-repeat: repeat-x; background: url(../images/navbutton_bg.gif); } nl#navBar li a:hover{ text-decoration: none; background-repeat: repeat-x; background: url(../images/navbutton_bg_hover.gif); } I have tried several different variations of code putting height attributes and displays as block, but no combination seems to work. Hi. I was developing a website . I decided to use float in order to align content on my webpage. Everything worked fine in IE but when I viewed page in NS then linkbar and main area that supposed to be aligned correctly, where collided together. The link to this webpage is: http://www.itcollege.ee/~rbomberg/hagerel/index.php If viewed in NS then you should notice that the links on the left are not aligned properly and main body text is also dislocated. The CSS file used for this website is available at: http://www.itcollege.ee/~rbomberg/hagerel/test.css Thanks for all the help. The title attribute will display black text in a yellow box on the mouse over of an element. Take this code: Code: <a href='#' title='This should be a different background color or something'>text link</a> I want to have the title attribute display with a different background color, different font color and font size. I was wondering how I might use CSS to get into this attribute and do some editing. Thanks in advance, Taylor I'm quite fluent in xhtml, css, and other crap...but I'm not sure why this doesn't work -> the height attribute is set to a percentage, yet it doesn't work...I know its acceptable i checked the css reference. view source on this Validated xhtml strict 1.01 EDIT: I FIGURED IT OUT... I NEEDED TO PUT THIS html, body { height:100% ; width:100% } Code: <!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"> <head> <title></title> <style type="text/css"> <!-- body { font-family: tahoma, verdana, arial } #main { width: 60%; margin: 10px auto; border: solid 1px #333; background-color: #fff } #header { padding: .5em; background-color: #fff } #sidebar { float: left; width: 100px } #content { padding: 20px; border-left: dotted 1px #ccc; margin-left: 140px } #footer { padding: .5em; border-top: solid 1px #ccc } --> </style> </head> <body> <div id="main"> <div id="header"> <h1>Header</h1> </div> <div id="sidebar"> <form action="login.php" action="post"> <p>Username: <input type="text" name="username" /></p> <p>Password: <input type="password" name="password" /></p> <p><input type="submit" value="Login"></p> </form> <ul> <li><a href="">Link</a></li> <li><a href="">Link</a></li> <li><a href="">Link</a></li> </ul> </div> <div id="content"> This is the content </div> <div id="footer"> Footer </div> </div> </body> </html> Why doesn't this automatically adjust the size of the div next to it? Am I better going for the position attribute here guys? Cheers Greetings All, Wonder if you might be able to assist... I'm trying to make a page accessible from IE6 and generic mobile devices. I have selected different images to be displayed on the mobile screens using the 'media' attribute eg: <style type="text/css" media="screen"> #mobileimage {display:none} </style> <style type="text/css" media="handheld"> #normalimage {display:none} </style> <div id="normalimage"> <img src="diagram 2 560wide.jpg"> </div id="normalimage"> <div id="mobileimage"> <img src="diagram 2 560tall.jpg"> </div id="mobileimage"> and this works just fine in IE6, Opera for Symbian UIQ (mobile device) and BlackBerry devices. However, the images are not displayed at all in Pocket IE on Windows Mobile 2003 devices, although other CSS layout is (kinda) OK. Apparantly, Pocket IE recognises 'all', 'screen', and 'handheld'. Any ideas whether this will work? How to get round it? All help gratefully received... Thanks, Nick. I'm having a little trouble with the Overflow attribute on my side scrolling website. I have uploaded 2 versions one and two of the same site, one with
Code: overflow:hidden; overflow-x:visible; and one with just. Code: overflow:hidden; the first one is completely static in safari and won't scroll at all but scrolls really nicely in firefox (with a scroll wheel as there are no scroll bars). The second one has a horizontal scroll bar but goes really wierd and starts scrolling horizontally as well which I don't want to happen as it messes up my site. Is there a way to get the site to scroll horizontally without scrolling vertically? I have tried it both this way and by only using Code: overflow-y:hidden; but it has similar results. Any help on this would be greatly appreciated I'm designing a webpage that uses an image for the header/logo. i need the page to have certain things: (1) it needs to be accessible for screen readers (2) it needs to have two stylesheets - the main one <link href= ............. media="screen"/> + one that enables printing of text only, without images e.g. <link href= ............. media="print"/> To get (1) i need to have the alt="whatever" attribute in the html, but i can only do that if i have img src="xxxxx" in the html. To get the print-text-only style sheet i need to have the image in the main css stylesheet e.g. background-image:url (xxx/xxx); instead of having img src="xxxxx" in the html. So my question is: how do I get alt="whatever" if there's no img src="xxxxx" in the html? Or what's the alternative? I hope this makes sense to you, 'cause I've been going round in circles with it! TIA, jifjaf Hi I am displaying images in a loop with help of DIVs so that they are displayed in a row. I want to show some text after them for which I am using a new DIV, to display the text beneath the ending of image DIVs I am using Code: <div style='clear: both;'> </div> it works but it displays the text in the very next line after the last Image's div. I want to give some space, for this I can simply use <br /> but I thought it might be possible with margin-top in the div, but when I write Code: <div style='clear: both; margin-top: 10%'> </div> it doesn't affect anything. Is it possible to give some space within div settings? |