SpOrTsDuDe.Reese Posted August 5, 2008 Share Posted August 5, 2008 Yea I'm only 16 and I think I'm pretty good at CSS. Though there are some questions I need answered (ALL)1: Is <img> inline by default?2: How do sprites work?3: What does zoom:1 do?4: Is 12px font == 1 em?5: Name ALL the block level elements that are used frequently6: Same but inline this time7: What browsers support inline-block and what is it8: Can inlines be placed inside block levels?9: Vice-versa of 8.10: Can you give me an overview or a small tutorial on expressions? Link to comment Share on other sites More sharing options...
Synook Posted August 5, 2008 Share Posted August 5, 2008 1. Yes2. By definition sprites are dynamic images. There are no "sprites" in CSS, though you can use JS to make a normal image act like a sprite.3. It is a CSS 3 property that defines the magnification of the current image. A value of 1 is the actual size.4. No. Ems are relative units that are dependant on the current font size. http://en.wikipedia.org/wiki/Em_(typography)5. <div>, <p>, <h1> ... <h5>, <pre>, <table>, <ul>, <ol>, <li>. (at least I use those alot)6. <span>, <img />, <code>, <abbr>, <a>, <br />7. http://www.brunildo.org/test/inline-block.html - basically it is a block, but doesn't break.8. Yes9. HTML inline elements cannot be placed inside HTML block elements validly, but if you make an inline element block using CSS then the validator won't catch you. Not recommended though.10. Err, as in regular expressions? http://www.regular-expressions.info/ Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 1. Yes2. By definition sprites are dynamic images. There are no "sprites" in CSS, though you can use JS to make a normal image act like a sprite.3. It is a CSS 3 property that defines the magnification of the current image. A value of 1 is the actual size.4. No. Ems are relative units that are dependant on the current font size. http://en.wikipedia.org/wiki/Em_(typography)5. <div>, <p>, <h1> ... <h5>, <pre>, <table>, <ul>, <ol>, <li>. (at least I use those alot)6. <span>, <img />, <code>, <abbr>, <a>, <br />7. http://www.brunildo.org/test/inline-block.html - basically it is a block, but doesn't break.8. Yes9. HTML inline elements cannot be placed inside HTML block elements validly, but if you make an inline element block using CSS then the validator won't catch you. Not recommended though.10. Err, as in regular expressions? http://www.regular-expressions.info/ 1) Thanks2) Thanks3) Thanks4) Yea ok I figured thanks.5-6) Thanks7) Thanks for the link8) Awesome thanks9) Ok.10) No, expressions in CSS. It combines CSS and JavaScript. Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 Expressions are only supported by Internet Explorer, so I don't recommend learning them, they won't work in the CSS validator either, they're not standard.I certainly don't want to waste my time teaching the wrong way to do things. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 I know how to do them but I was hoping for a proper way. If you aren't going to bother helping me with expressions, that is your choice but I need to learn it. Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 There's no "proper way" with expressions. The only standard substitute for it is to use Javascript itself to fix your page, but it will then display incorrectly for users who have Javascript disabled.For example: <div id="box">Box</div><script type="text/javascript">//Make the box the height of the window - 100pxdocument.getElementById("box").style.height = (screen.availHeight - 100) + "px";</script> Link to comment Share on other sites More sharing options...
Synook Posted August 5, 2008 Share Posted August 5, 2008 Don't worry about expressions. if you need to dynamically set properties do it with a JavaScript script, e.g. instead of #element { height:expression(window.offsetHeight);} Do <script type="text/javascript">document.getElementById("element").style.height = window.offsetHeight;</script> and place it after the #element element is written.Edit: Ingolme got there first. But curious: why do you need to use expressions? Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 The question whether I need to..eh not really. What does#element { height:expression(window.offsetHeight);}do. It uses the height property, what is offsetHeight? window is the browser... Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 The offsetHeight property of basically any element returns its height without being affected by margin, padding or borders. Link to comment Share on other sites More sharing options...
Synook Posted August 5, 2008 Share Posted August 5, 2008 window.offsetHeight doesn't work, I was just using it as an example Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 Well can you give me an example, of where it takes the parents height, and subtracts 200 px from it? It can be any example like that and no I'm not copying it for homework or anything. It was just a random example. Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 This javascript would work on an object with id "box".document.getElementById("box").style.height = (document.getElementById("box").parentNode.offsetHeight - 200) + "px"; Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 I could use that code, and place it as the value of the property height:? Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 No you could put that code between <script> tags and put it after the "box" div. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 But that wouldn't make it a CSS expression. I need it in EXPRESSION form. Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 I think it would be something like this:height: expression(document.getElementById("box").parentNode.offsetHeight - 200);Hopefully this runs after the "box" element has loaded. If not, then I don't think it can be done. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 I could have it inline with the element that should be repositioned based on this expression. Right? Link to comment Share on other sites More sharing options...
Ingolme Posted August 5, 2008 Share Posted August 5, 2008 You probably could put it on an element with the style attribute.Why such interest? Like I said earlier, this isn't a very recommended method for good reasons. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 5, 2008 Author Share Posted August 5, 2008 Not interest, merely questions. I know a lot of CSS...I know about the style attribute. I moderate 2 forums for CSS. Link to comment Share on other sites More sharing options...
Synook Posted August 6, 2008 Share Posted August 6, 2008 Expressions aren't part of CSS. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 6, 2008 Author Share Posted August 6, 2008 Technically they are CSS and JavaScript combined. You can PLACE them in CSS so thus I need to learn them. Link to comment Share on other sites More sharing options...
jeffman Posted August 6, 2008 Share Posted August 6, 2008 Just to be clear. What you are discussing works ONLY in IE. However useful it is, it excludes a huge cross-section of users. Apart from everything else, this means that you are likely to be ignored by most of the regular contributors on this board. And FWIW, it also makes you the puppet of an arrogant corporate giant, which is in direct contradiction to the original spirit of the web, which was to be INclusive rather than EXclusive. (Some of that's my opinion, some of it's just fact.) Link to comment Share on other sites More sharing options...
Synook Posted August 6, 2008 Share Posted August 6, 2008 Technically they are CSS and JavaScript combined. You can PLACE them in CSS so thus I need to learn them.Point out which part of the CSS 2.1 specification they are in. :)What I mean is that they aren't part of the language defined by the W3C as "CSS". Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted August 6, 2008 Author Share Posted August 6, 2008 I'll prove they are part of CSS and JavaSCriptheight: expression(document.getElementById("box").parentNode.offsetHeight - 200);height: is CSSexpression(......) onward is JavaScript.I'm not saying I'm going to use it much or even at all. I just want to clear it up. Link to comment Share on other sites More sharing options...
Synook Posted August 7, 2008 Share Posted August 7, 2008 that's like saying that "blahblahblah" is part of PHP because I can write$string = "blahblahblah"; And that "blahblahblah" is also part of CSS because I can write element:after { content:"blahblahblah";} Expressions are not part of the official CSS syntax. Is that unambiguous enough? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.