HTML/CSS:CamelCase vs Underscores [closed] - html

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have read lots of articles about advantages and disadvantages of camelCase and Underscore naming conventions. I've always prefered camelCase mainly because it saves bytes.
But learning about BEM, I've been really confused. BEM naming is more readable but '_','__' and long names add file size. Also I couldn't found any js plugins with it. So which one is better for qualified webpage?
P.S. sorry for bad English. Any opinion is appreciated

For css I can't recall I ever seen camel case (in professional work).
For me I use BEM when I work on private projects. I tend to use double underscore like .banner__image and .banner__image--large (you get it if you read the BEM specs).
At work our team use BEM with a modification though, only one underscore or hyphen (for modifiers) .banner_image and .banner_image-large.
If not using BEM you probably should write classes with a hyphen (-). Like this .banner-image and .banner-image-large. For examples you can look at Twitters bootstrap structure with class names, or any other site infact.

Related

CSS methodology: OOCSS vs. BEM [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
Which one should I use, OOCSS or BEM, when you want to write clean CSS? Is there any reason that you may prefer to use one over the another?
At the end of the day you should know what your particular use case is and learn what works for you. Obviously if you're working for a company and they prefer one over the other you wanna go with that!
My team and I wrote out our own internal CSS namespace specifications which are based off of BEM. The reason we prefer BEM is largely because of how extremely self-documenting it can be. I can look at a class name and know everything about that class's element.
However, there's no right or wrong answer. As long as your code is self documented, clean, and easily maintainable. Use whatever standard you want.

Are variables commonly used in CSS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
Modern CSS gives us the possibility to use CSS variables that we can reference in multiple other places.
To what extent do they differ from the variables within JavaScript?
Am I more performant when I set CSS attributes or values via JavaScript, or the opposite is the case? Is that a chicken and egg story, or is there a proven way to do that?
Yes, variables are generally used when you are developing something big and you don't want to repeat your reusable colors or any other properties. But if you're just starting then I don't think it necessary to use variables more. If you want you can but not necessary.
You may also find that in frameworks like bootstrap or material css variables are declared once and used in many places.
Usage of variables makes more sense when you are using any preprocessor like Sass or less or something else.

What is the benefit of semantic tags? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm following a tutorial series on web development. While I already have a basic understanding of HTML and how to use it to structure a page, I'm indulging myself and watching the very beginner tutorials. The funny thing is, in these tutorials the author is using tags like address and cite. When he describes why one should use these tags, he explains it only as "semtantics."
While I feel like these tags may have been more prevalent ten years ago, I never run across anyone using them besides this guy. Given he is professional, I'm now conflicted on whether or not its really necessary to use them. What is the benefit?
According to the current HTML5.1 specification nightly (as modern as it gets):
The address element is valid perfectly fine to use and so is the cite element. While a lot of sites tend to mostly use tags like div and span you can feel safe to use both address and cite .
I think it's good practice that will help you later when you have to read your HTML again to insert changes. It improves accessibility of your document as well as lets parsers other than browsers understand it better.
(Note, address and cite are legal in the old HTML specification too)
The benefit of semantic tags is that they give your html some structure - by using them you are encoding meaning into your html that can be useful in all kinds of areas. Search engines often use semantic tags to assist in ranking pages, to use a simple example. Whilst it might not always seem necessary, it is good to get into the habit of using them wherever possible.

Should I separate typography section from the HTML hierarchy? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Is it a good practice to make a separate section of CSS rules applying only for typography? or should they be part of the HTML hierarchy flow?
The question is mostly from readability and maintainability point of view.
In my opinion, it's best practice to keep things modular. Put your CSS in its own file(s), and, if you have a lot of stylings (very common), I'd say you can have a typography.css to make the rules very clear. HTML is supposed to be meaningful (as the purpose of HTML5 is to go back to this idea), and this should extend past the use of tags to the placement of files and readability of your code.
Hope this helps.
There is of cource no correct answer to this question, but in my experience: both.
I feel that I gain a lot from a good css reset, and they do tend to handle some typography.
But aside from that I have yet to gain from a separate style-sheet for typography only.

What's the easiest way to convert Wiki markup to HTML? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm building a website that requires very basic markup capabilities. I can't use any 3rd party plugins, so I just need a simple way to convert markup to HTML. I might have a total of 3 tags that I'll allow.
What is the best way to convert ==Heading== to <h2>Heading</h2>, or --bold-- to <b>bold</b>? Can this be done simply with Regex, or does somebody have a simple function?
I'm writing this in C#, but examples from other languages would probably work.
It's not really a simple problem, because if you're going to display things back to the user, you'll need to also sanitise the input to ensure you don't create any cross site scripting vulnerabilities.
That said, you could probably do something pretty simple as you describe most easily with a regular expression replacement.
For example
replace the pattern ==([^=]*)== with <h2>\1</h2>
This really depends on the Wiki syntax you're using as there are several different ones. Obviously the wiki software has this functionality somewhere; if you can't find a software package that does this for you, you could start looking for the relevant code in your wiki software.
Maybe this is what you need.
This page is a compilation of links, descriptions, and status reports of the various alternative MediaWiki parsers — that is, programs and projects, other than MediaWiki itself, which are able or intended to translate MediaWiki's text markup syntax into something else.