Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
Like Tree8Likes
  • 1 Post By mryahya
  • 3 Post By Ronald Roe
  • 1 Post By TheGAME1264
  • 1 Post By TheGAME1264
  • 1 Post By Ronald Roe
  • 1 Post By TheGAME1264

Thread: General CSS

  1. #1
    Junior Member
    Join Date
    Apr 2016
    Posts
    1
    Member #
    53779
    Liked
    1 times

    General CSS

    Following the General JS thread, why not start a general CSS topic, where we can cover everything recent and possibly answer questions?

    I will start with a question about the use of id selectors in CSS. I was just looking at Harry Robert's Nudge [EDIT: link removed by TheGAME1264 because it contained malware] and noticed the following:

    No IDs We shouldn’t use IDs in CSS, so display a warning any time we find one.

    Is that becoming a standard now (no id selectors at all) and in which cases do you think we should use ids in CSS? Or does that relate to large scale UIs and not smaller projects?
    Last edited by TheGAME1264; Apr 05th, 2016 at 10:01 AM.
    D-Panthenol likes this.

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    This link seems to work better and doesn't have the malware.

    https://github.com/csswizardry/nudge

    With that said, I have no idea who Harry Roberts is and how he anointed himself as a Guru, but that is one of the dumbest things I have ever heard when it comes to CSS. If we weren't meant to use IDs in CSS, then IDs wouldn't be a part of the CSS specification in the first place. IDs in CSS have a specific use case...to define styles for a single element.

    Then again, this whole Github project just seems like "one guy's opinion on how CSS should be coded", based on nothing other than his feelings. Take this whole project with a grain of salt.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    I've heard this before. The standard argument tends to be that it's hard to selectively override them because ID has higher specificity than other selectors, which can easily be fixed by writing your CSS more intelligently to begin with.

    I personally never select using IDs. No mantra behind it. I rather like the way classes can be stacked, so I just go with that.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Part of my reason relates to ASP.net. In ASP.net, and Ron you'll come across this eventually if you haven't already, you look at HTML elements a little differently...you look at them as server-side controls, and each of those controls requires a unique ID in order to be able to manipulate the control. For example, you may have something like this:
    Code:
    <div id="date_range" runat="server"></div>
    for a range of dates that you can generate from server-side code (not the best example, but it'll do for this purpose). Now, I could assign a CSS class to it if I wanted to add CSS styles, but why? I'd just be generating additional markup for a CSS class that I'll only use one time. Doesn't make sense.

    Now...it would make sense if I wanted to use a CSS class here and I had other uses for some or all of the styles within said class, and I'd still have the ID for a final override for specific purposes if I needed to without needing a specific single use class.

    I don't know if this counts as a mantra, but it's mine.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Quote Originally Posted by TheGAME1264 View Post
    Part of my reason relates to ASP.net. In ASP.net, and Ron you'll come across this eventually if you haven't already, you look at HTML elements a little differently...you look at them as server-side controls, and each of those controls requires a unique ID in order to be able to manipulate the control.
    I have, and on a side note, I haven't decided if the problem is the tech or the way she's teaching it (suspect combination of the 2), but I hate it.

    Now, back to the main point here: you think differently than I do, therefore you are wrong and st00pid. IDs should never be used for anything, evar. Need to scroll to a particular element on the page? You best brush up those jQuery skills (were there such a thing). And clearly, div.form.date input.date.range[type=range]{ ... } is far better than #date_range, because words.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    You're right. Your words trump my words, because classes. You have more classes than I do so your argument is classier than mine so you win teh debatez! You're all right, Ron, and your smartassedness that counters my smartassedness is always awesome.

    There are uses for elements as server-side controls. For example, you can control their visibility, which means that if you want an element not to show up (e.g. if you don't have a date range), you don't generate the HTML for that div...which means that the other elements on that page will move up, you'll reduce your HTML output, and you won't have a weird gap as the result of an empty element in it that has say padding or margins set for it.

    Another advantage relates to forms. Since ASP.net forms post back to themselves, you can have a thank you div for a contact form (or a panel if you prefer...I prefer the div) with visibility set to false (for the non-ASP.net types, visible="false" means the div doesn't show up at all, including HTML code). You put your form in another div control and when it's successfully filled out, you set that div control's visibility to false and the thank you div's visibility to true.

    I have another use for it that I'm about to drop on people in a few weeks, as it relates to content from an SQL server database and when it is/isn't available.

    I like it, but then again...I have strange uses for, and I think differently than you do! By the way, we have to work on that. Only through uniformity of thought can we truly progress as a society!
    Ronald Roe likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  8. #7
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Yeah. It's not an altogether horrible pattern, but I think I prefer the way other languages do it. I see what MS was trying to do, essentially separating out the backend logic. It does feel, and again this could just be the way she's teaching it (creating a skin for a calendar felt icky), like I'm using Design view on Dreamweaver. I'm sure, like in most development technologies, that there's an optimal way to use ASP, and as one would expect, academia is failing to teach it that way.

    In all of the programming classes I've taken, in all the thousands of lines of code I've written for homework, there has ever only been one mention of "this way is better than that way because it's more performant".
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  9. #8
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Are you talking about the AJAX Toolkit calendar control? I used AJAX Toolkit at first when I was "learnding", and then realized how horribly limited and awkward it is so I use my own custom control whenever possible...although admittedly I don't have many uses for it these days.

    I'm not surprised at the lack of performance mention. Most ASP.net stuff, and this actually goes back to classic ASP, is "teach it this way because we think it's the easiest for people to grasp, even if it isn't the most optimal way to do things." A lot of the controls and things are based on tables and are almost completely useless in modern web development (e.g. the GridView...I never use that). It doesn't help that most teachers are 5-10 years behind where they're supposed to be by design, either.

    Hopefully they cover partial page caching at some point, though. If they do, that alone will make this class you're taking worth it. If not, learn it on your own.
    satindertech likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  10. #9
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    It's a standard toolkit, table-based, non-responsive atrocity.

    You hit the nail on the head with THE Doctor Kalata, tho. Except, she's closer to 15-18 years behind. She's teaching inline styles, drag/drop in design view, and other awfulness. Then, she's shoehorning Bootscrap into it, but I'm pretty sure I'm the only one who would have any clue that that's what she's doing. No explanation of how adding stacked classes to a nav element is making it look like it does because of Bootscrap.

    Had the same problem with her in the front end class too. I was docked points because I wrote my JS using object-oriented style rather than the procedural way she was looking for. "It's not within the scope of this class", I was told. Mind you, half the class was about learning JS.
    satindertech likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  11. #10
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Oh sweet cream on an ice cream SAMMICH that's dumb!

    It's the way you're being taught. ASP.net doesn't have to be that way. I've been working with it for about 7 years now and I've never once used Bootcrap for of it.
    satindertech likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:54 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com