CSS - Can Css Be Dynamic ?
I was thinking of using DIVs insteed of table to layout my page.
The page would be dynamic meaing the text would come from DB so i would have new articles comming in daily. I will like I cant controll where the text is put on the text. If I use CSS width="20px" and hight"20px",, <-- Yeah i know it down to the pixle,, but that would mean i would need to make a new CSS for every article that where put into the db. <-- which would be a pain. So how can I keep the controll of placing my text without using tables ? Please help a new CSS user. Similar TutorialsHi Guys... (and Girls) Great Forum you have going here... I've got a quick question regarding Dynamic CSS. I need to mention now though - I'm doing some development work at the moment, but, I'm not a developer so my approach and question might seem unusual to the experienced guys out there. Situation: I'm currently building a new site which is styled completly with CSS - e.g. No Tables or Cells. It's the first time I've done it but it's working great! The website is currently a fixed 760px across so that it will fit into 800 x 600 screen. Market research suggests about 20% of the visitors to this site use a 800 x 600 screen resolution and so I don't want them to have a horizontal scroll bar, but I would like the site to be at least 800px across for everyone not using a 800 x 600 screen resolution. My question is - Can I use a Javascript function to grab the screen resolution of a visitor to the site and then dynamically update the CSS of the site depending on screen resolution? And if so do you think it's a good approach? I'm sure there are others ways to do it but I'd prefer to work within the skills I already have, which includes Javascript and PHP. Thanks for the help... Matt Edwards I have <div> content that diplays at different sizes in IE and Mozilla, which makes lining up the <div> container below it difficult. How can I get the <div> container to expand to the size of the content height wise so that I can then capture it's height with js, setting the <div> container below it to it's proper poisition. Thanks. I want to have a web page with a list on it that dynamically resizes to fit the browser viewport with a minimum distance between list items. Here's an example I faked in TextPad: Normal view: User enlarges browser: User shrinks browser: How would I accomplish this in HTML/CSS? Thanks! Thank you for your time and assistance. I am working on building my first website in 2 years. I am very interested in developing a good site interface with standard code that may be easily edited later. Specifically, I am interested in creating dynamic navigation menus that will be supported by as many browsers as possible. I have seen dynamic menus created with javascript, but I know I don't want to do that since some browsers do not support it/or do not have it enabled by default. Can you comment on whether or not CSS would be a good solution to get around this problem? I have never used CSS to create menus in the past, but it seems very useful for standardizing a site interface. I am also open to other suggestions, what would you do to accomplish this task? hi all ! I have some dynamic data that gets inside a cell in a table, the problem is that Im having problems to adjust the cell so the data can be seen more user friendly. The max width for the table is 1024 px. This is how it looks: Is there a way to make it look better using dynamic css,script,etc? Thanks a lot ! Hi I'm trying to CSS a dynamic table using Dreamweaver CS4 the problem i have is to set my css i have to have 2 rows 1 odd 1 even and dreamweaver only gives me 1. I've added a second row which just remains blank. Can anyone help Heres my html / PHP: <div class="donation_table"> <table> <thead> <tr> <th>FAMILYNAME</th> <th>FAMILYCODE</th> <th>DONATION</th> <th>DATE</th> </tr> </thead> <?php do { ?> <tbody> <tr> <td><?php echo $row_Recordset3['FAMILYNAME']; ?></td> <td><?php echo $row_Recordset3['FAMILYCODE']; ?></td> <td>$<?php echo $row_Recordset3['DONATION']; ?></td> <td><?php echo $row_Recordset3['DATE']; ?></td> </tr> <tr class="rowline"> <td></td> <td></td> <td></td> <td></td> </tr> </tbody> <?php } while ($row_Recordset3 = mysql_fetch_assoc($Recordset3)); ?> </table> </div> And heres my PHP code $maxRows_Recordset3 = 25; $pageNum_Recordset3 = 0; if (isset($_GET['pageNum_Recordset3'])) { $pageNum_Recordset3 = $_GET['pageNum_Recordset3']; } $startRow_Recordset3 = $pageNum_Recordset3 * $maxRows_Recordset3; mysql_select_db($database_MafiaLive, $MafiaLive); $query_Recordset3 = "SELECT FAMILYNAME, FAMILYCODE, DONATION, `DATE` FROM donations ORDER BY DONATION DESC"; $query_limit_Recordset3 = sprintf("%s LIMIT %d, %d", $query_Recordset3, $startRow_Recordset3, $maxRows_Recordset3); $Recordset3 = mysql_query($query_limit_Recordset3, $MafiaLive) or die(mysql_error()); $row_Recordset3 = mysql_fetch_assoc($Recordset3); if (isset($_GET['totalRows_Recordset3'])) { $totalRows_Recordset3 = $_GET['totalRows_Recordset3']; } else { $all_Recordset3 = mysql_query($query_Recordset3); $totalRows_Recordset3 = mysql_num_rows($all_Recordset3); } $totalPages_Recordset3 = ceil($totalRows_Recordset3/$maxRows_Recordset3)-1; Thank you Daniel Despite looking through the forum, having problems with dynamically creating an external CSS file. Can any one explain? Basically I currently have a CSS file: Code: .normal { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; } .userdef { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #FF0000; font-weight: 800; } .big { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } I have set the site up so that the user can define there own colour of text for the userdef style, but im unsure how I can put this colour variable into the CSS file. I'm guessing I have to rename it into a .php file... but how will the browser still know its a CSS file?? Thanks very much for your help Hi all, Bit of a stupid question this as I have checked w3 and w3schools et al and could find anything on this, but: Are wildcards usable in CSS? Example: I am going to be generating blocks dynamically, and instead of writting all these blocks into a stylesheet, I wondered if you could do it using wildcards. Example: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- Creation date: 01.10.2004 --> <head> <title></title> <meta name="description" content="" /> <meta name="keywords" content="" /> <style type="text/css"> <!-- #block {color: red;} --> </style> </head> <body> <div id="block">Text</div> <div id="block2">Text 2</div> <div id="block3">Text 3</div> <div>Text 4</div> </body> </html> Changing the #block reference to #block* doesn't work, any ideas? I don't want to have to add #block, #block2, #block3 {color: red;} etc... Hello all, I'm trying to create a site using all css positioning but I'm running into some problems that to me, shouldn't even be problems. The main issue I'm having is getting a container div's height to expand based on the height of divs nested inside the container. Vut all I get is the nested divs flowing outside of the container div. I don't have any code to share, because I have it so screwed up right now it wouldn't even help explain my issue. I'm going for a 3 column design, that is wrapped by said container div, and the container divs height would be based on the height of the longest div nested within. I've done alot of searching on the web, and the answer seems to be that this can't be done. But I'm giving it one more try here. I'm also a bit confused about relative positioning. Say that my conatiner div actually worked, and the height adjusted appropriatly. I have a left column, and a right column. both are position relative to the container. But when I do this, it seems to come out that the right columns top positioning is relative to the left columns positioning. If I design everything based on viewable browser area, and allow scrolling when necassery, css is a dream. But thats not very practical. It seems that css great for static websites, but not quite up to par for anything dynamic. Once I calm down and I'm not so frustrated, I'll start over and post some code if my explaination isn't descriptive enough. Any input would be appreciated! :-) Hi. I would like to create a gradient similar to the microsoft website. http://www.microsoft.com/downloads Look how the gradients at the top and bottom of the page work. Im sure this is not simply repeating an image. Does anyone know how this works? or can point me in the direction of a tutorial on how to achieve this? I looked at the microsoft site in Opera and NS, and the dynamic grad only seems to work in IE. So im guessing that you can also set a bkgnd image? for the other browsers? many thanks. Hi All, I've got one of those wonderful CSS/javascript flyout menu's running on my website which is causing me a little bit of grief in Firefox and Safari. Firefox and Safari seem to be placing the 2nd and 3rd level items of the menu underneath all the other content on the page and therefore can't be seen. Seems to work well on Opera and IE. Here are the screen shots of what is happening in each browser: http://dev.platforminteractive.com.au/cssissue/css_ff.jpg - firefox http://dev.platforminteractive.com.au/cssissue/css_opera.jpg - opera http://dev.platforminteractive.com.au/cssissue/css_ie.jpg - ie You can take a look at the site and the coding behind it at http://dev.platforminteractive.com.au - just in development atm but this nav is causing me some grief. I have the task of creating a question with multiple correct answers without using form checkboxes (for reasons I won't go into here.) I've made a simple question that works by replacing the src of a tickbox image with a ticked one when that answer is selected. It works in IE5.5 and Firefox but in IE6 the images show when the page loads, then disappear on clicking and don't come back. Can anyone suggest why? I've stripped out all the branding etc and put the basic page at http://www.normanlamont.com/test/mu...pages/index.htm Here's the code that does it: Code: function markup(which) { // toggle tickbox on and off until submit if (document.getElementById('c' + which).className=="chosen") { document.getElementById('tick' + which).src="../q_images/tickbox_0.gif"; document.getElementById('c' + which).className="not_chosen"; selected[which-1]=0; } else { document.getElementById('c' + which).className="chosen"; document.getElementById('tick' + which).src="../q_images/tickbox_1.gif"; selected[which-1]=1; } } Ok im trying to have a division that expands with the content however, although this works in IE if i dont specify a height, in browsers like firefox the background color just stops even though the content carries on. Code: <div id="content"></div> Code: div#content { background-color: #F3F3F3; } ive tried adding height: 100% but it doesnt make any difference Hi all- I am building a tableless site out of divs/css and cant seem to get the one div positioned properly. I need to make the site as dynamic and liquid as possible so absolute positioning (i.e. width:320px; etc) is out of hte question... http://verticalextreme.com/about/hours_pricing.html i am trying to have the HOURS div and hte PRICING div inline with each taking up 50% of the main content width i currently have the following css: Code: #hours { display: inline; clear: none; width: 50%; } #pricing { clear: none; display: inline; width: 50%; } Thanks for any help in advance - rock on If I have the following: <span id="span1"></span> <span id="span2"></span> If I set the width of span1, I want to have span2 adjust it's width to be the same automaticly. Something dynamic or a variable. For example in simple terms. span1.width = 150px; alert(span2); would show 150px also. Hope that make sense. Thanks I'm kind of new at the whole CSS thing (though I have lots of other web programming experience) and I was wondering if it's possible to create an inline dynamic table. Basically what I want to be able to do is have the user enter in a number and hit enter (or a button) and have a table with that many rows (and a set number of columns) appear on the page without the page being reloaded. Is this possible to do with CSS in a way that most browsers support? If there is, can someone point me to a resource that would have information such as this? Thanks! I am newbie in CSS but I do not want to surrender to use tables. In Explorer it is seen OK but is wrong in Firefox. Why? URL URL www.lekunberri.com/focesdelcamino/mapa.asp?id=31 There is div called "mapaaundi" with relative positioning that contains images as fragments of a map. Inside there are some images (arrows) of the class "boloaundi", with absolute positioning. I have previously tried something similar to this and works well. Thanks in advance! Apologies but this question falls into a number of camps. I am generating dynamic data via PHP calls to a MySQL database. The problem is that some of the data returned requires formatting. For instance, dynamic list boxes are too wide because some strings returned are very long. Secondly, some dynamic text is also too long and it is extending my tables beyond what I would like. One solution is to run SELECT LEFT queries to truncate the data but this is not very elegant since this is a formatting issue and I prefer not to introduce queries to format data. Is there a way of: i) Specifyin maximum list menu widths in CSS ii) Specifying the maximum table with, regardless of length of a text string, or maybe to trim the dynamic string to a maximum number of characters. Thanks Hello all: I got a quick question....does anyone know a method that you can generate CSS out of photoshop right away? I know how to do it with div tags etc. but I was wondering is there was a method of going about it where a person can dynamically generate reusable CSS like in the format H1 etc. etc. and not just <div id etc.> thanks! Is it possible without any client side scripting to load in backgrounda.gif for 800x600 resolution and backgroundb.gif for any other resolution? Server side scripting is ok but I was hoping for a CSS method although I am pretty sure it's not possible. |