1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to use Less CSS in HTML5 Templtes

Discussion in 'CSS' started by rohittripathi, Mar 20, 2013.

  1. #1
    I every one on DP, I want to know less css support html4 and html5 while making templates,
    how to start making website using less css, and one more thing less css support only twitterbootstrap or less css i can use any kind of templates.
     
    rohittripathi, Mar 20, 2013 IP
  2. Logist

    Logist Greenhorn

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    21
    #2
    You can use Less.js.
    Less.js is a JavaScript implementation of LESS that’s run by your web browser. As any JavaScript, you include a link to the script in your HTML5, and…that’s that. LESS is now going to process LESS code so instead of including a link to a CSS file, you’ll include a link directly to your LESS code.
    Example:
    <link rel="stylesheet/less" type="text/css" href="styles.less">
    <script src="less.js" type="text/javascript"></script>
    Code (markup):
     
    Last edited: Mar 21, 2013
    Logist, Mar 21, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    My advice: DON'T!!!

    Throwing more code at a site is NEVER the right answer -- and between the idiotic BS HTML 5 code bloat you're going to have, you're going to rely on some idiotic garbage crutch for your CSS as well?!?

    LESS, OOCSS, HTML/CSS frameworks (like bootstrap or yui), scripting frameworks (jquery, mootools) -- it's all pointless extra crap that if you 'need' or offers anything resembling an 'improvement' probably means you're doing something WRONG!

    Put your effort towards minimalist semantic markup, separation of presentation from content and properly leveraging inheritance, and you'll find things like "LESS" to be nothing more than a complete waste of time and effort.

    Much like jquery, Dreamweaver, HTML 5, and a whole host of other BS, I cannot fathom how or why anyone would choose to use it apart from ignorance, laziness, or just plain wishful thinking! As to the people who come up with this type of nube predation, it would be great if we could just line them all up against a wall Red Dawn style.
     
    deathshadow, Mar 21, 2013 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    That's about as silly an idea as I've heard in quite a while. You want to do something dumb like code your css using LESS and then have to use a client side preprocessor to make it usable. The deal is, you learn selectors, inheritance and specificity; use them correctly, against well structured documents having valid html, and you have easily understood and maintainable css.

    It's not often, rare even, that I think deathshadow is being gentle. I really need to note this in my diary, as it is unlikely to happen again within my failing memory. Ds is capable of much better.

    jeez,

    gary
     
    kk5st, Mar 22, 2013 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #5
    I think you meant server-side... since client side (javascript) means it doesn't work when javascript is missing or intentionally blocked.

    See Opera users who use the in-built blocker and selectively activate it, and all the people who download the noscript plugins for Firefox. (and I hear there's a Chrome version now?)

    Also why the various shiv/polyfill/whateverTheHellThey'reCallingThemThisWeek for HTML 5 and/or CSS3 just heap on the already idiotic nonsense known as HTML 5.
     
    deathshadow, Mar 22, 2013 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    The post I was replying to specifically called for javascript, so no, I did not mean server-side. Using Less or similar crap is bad enough, but to do it in a manner that decodes client-side is stupid.
     
    kk5st, Mar 22, 2013 IP
  7. CharlieL

    CharlieL Active Member

    Messages:
    69
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    55
    #7
    What's so bad about jquery, deathshadow? I haven't really played with it yet myself, I'm more of a HTML/CSS kind of guy, but the rest of the internet seems to be raving about it?
     
    CharlieL, Mar 22, 2013 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    I realize you asked ds, but I'll give you my take, which is not quite as negative as ds's.

    jQuery is an amazing library of js functions that, with a fairly simple API, allows almost anyone to do what the js gurus do. There are two problems that I see:
    1. In order to deal with a huge variety of specific needs, the coding is necessarily bloated. Made to measure functionality is nearly always much lighter.
    2. Then, there is the issue of the size of the library. I have seen, again and again, authors importing an entire library plus every plugin they've ever seen to accomplish one function that requires maybe nine or ten lines of code. Good practice would require the library to be pared of unused functions, but that requires more knowledge than a beginner is likely to have. For my own needs (not really that great), it is just simpler to bring together the functionality I need and create a library myself.
    3. [Bonus] jQuery makes it too simple to trick up the page for the sake of tricking up the page. Most of what authors do in jQuery were better left undone; they're simply being annoying.

    cheers,

    gary
     
    kk5st, Mar 23, 2013 IP
  9. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #9
    Gary hit a few of the good points -- but there's more.

    By itself whitespace compressed it is HALF my ideal size for a page template -- that's HTML+CSS+SCRIPTS+IMAGES -- not counting content images, and a quarter the upper size I generally allow for a normal page on a site; and that's NOT "whitespace compressed" since I generally consider that a sleazy practice used to sweep garbage code under the rug.

    While you'll have the apologists and fanboys making claims that it helps with 'cross browser' scripting, 90% or more of it's codebase has little if anything to do with that and falls into two categories -- stuff that has no damned business on websites, or things that have no damned business being done in javascript as that's CSS' job. It's why whenever anyone says "use jQuery" the correct answer is usually the exact opposite. If you understand accessibility and CSS, poke your head into the javascript and jquery forums here on digitalPoint (particularly the latter) for post after post of idiocy that fits said description exactly. I don't even bother poking my head into the jquery area anymore given the idiocy of replicating framesets with scripting to piss away accessibility, using scripting for hover states, color changes, layout, etc, etc... Serious herpaderp territory.

    ... and to be frank, it makes the code needlessly and pointlessly cryptic just because some people get lazy about typing the name of something (which is ALWAYS sleazy coding practice), the antithesis of clean/clear/comprehensible code.

    I have NEVER seen a site using jQuery that was worth a flying purple fish, and have seen scores of perfectly good websites that are less useful now that they use it than they were without it. It is one of the dumbest choices you could make in terms of web technologies, and you'd have to be a total Kevin Yank-hole to promote it's use. It is another of those bits of web tech that people are dumber for having even seen, much less tried.

    <mother>...and if everyone else ran off a cliff would you do it too?</mother>
    Remember, when you say "The rest of the Internet" you basically mean a bunch of drooling halfwits, sleazeball scam artists, and lazy ****'s who should do the world a favor, back the **** away from the keyboard and go take up something less dangerous like macramé weaving. Even worse, and as I keep saying, most of them have their heads wedged so far up 1997's arse it would take an orthodontist to handle the extraction.

    But of course, that's always the danger of bandwagon, card stacking, transfer and glittering generalities; it convinces people to make irrational decisions without taking the time to rub a few brain cells together.

    @gary, re-read the sentence I replied to... You've got your tenses backwards and/or out of order. It sounded to me like you were saying to use it client side.
     
    Last edited: Mar 23, 2013
    deathshadow, Mar 23, 2013 IP
  10. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #10
    @ds Go back one more quote, and I think it makes sense; though maybe a question mark would have emphasized the silliness of this:
    Emphasis added.

    cheers,

    gary
     
    kk5st, Mar 23, 2013 IP
  11. rohittripathi

    rohittripathi Greenhorn

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #11
    I would like to thanks everyone for getting such response.
     
    rohittripathi, Apr 23, 2013 IP
  12. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78