New Style for phpBB 3.3 ?

Discuss requests for comments/changes posted in the Issue Tracker for the development of phpBB's style.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB or modifying styles of released phpBB versions. If you need support for phpBB please visit the Support Forums on phpbb.com.

If you have questions regarding creating styles please post in Styles Support & Discussion to receive proper guidance from our staff and community.
Locked
User avatar
Louis7777
Registered User
Posts: 394
Joined: Fri Apr 04, 2014 12:32 am

Re: New Style for phpBB 3.3 ?

Post by Louis7777 »

Rhino.Freak wrote: Wed Jun 15, 2016 7:37 am This. So much this. Also I would like to contribute to this theme in any way possible :)
You still have not answered me about IDs.

Do you have the knowledge to provide an answer or were you just following an Internet hype about not using IDs?

Rhino.Freak
Registered User
Posts: 48
Joined: Thu Dec 24, 2015 10:47 am

Re: New Style for phpBB 3.3 ?

Post by Rhino.Freak »

I didn't know there was a hype for it? I read the blog from a popular and knowledgeable man and I would believe his words over any other random person's.
1. Speed regarding how fast the browser matches an element.
If there's just one class, the speed would be same wouldn't it?

Regarding your second point. Yes finding anything with "id=" or "#something" will be faster but if we write class names properly, there's really no real need of IDs.
There you go.

User avatar
Louis7777
Registered User
Posts: 394
Joined: Fri Apr 04, 2014 12:32 am

Re: New Style for phpBB 3.3 ?

Post by Louis7777 »

Rhino.Freak wrote: Wed Jun 15, 2016 4:01 pm I didn't know there was a hype for it? I read the blog from a popular and knowledgeable man and I would believe his words over any other random person's.
So if you read a blogger who is popular and knowledgeable, then you go and spread his words as an absolute truth?

I'm talking about this:
"Whatever style you make and whenever you make, just never use any id in the markup. It's really useless and has no benefits over classes."
Rhino.Freak wrote: Wed Jun 15, 2016 4:01 pm If there's just one class, the speed would be same wouldn't it?
To my knowledge no. The browser has to make sure that there aren't any other classes. With an ID it just stops looking.
Rhino.Freak wrote: Wed Jun 15, 2016 4:01 pm Regarding your second point. Yes finding anything with "id=" or "#something" will be faster but if we write class names properly, there's really no real need of IDs.
There you go.
Elaborate on that.

Do you imply using specificity in the class name? ;)

What I also said is that if you change the class for an associated element in a template, then you have to make sure that no other elements - in the same or other templates - have been affected.

Rhino.Freak
Registered User
Posts: 48
Joined: Thu Dec 24, 2015 10:47 am

Re: New Style for phpBB 3.3 ?

Post by Rhino.Freak »

Louis7777 wrote: Wed Jun 15, 2016 4:10 pm
Rhino.Freak wrote: Wed Jun 15, 2016 4:01 pm I didn't know there was a hype for it? I read the blog from a popular and knowledgeable man and I would believe his words over any other random person's.
So if you read a blogger who is popular and knowledgeable, then you go and spread his words as an absolute truth?
A fact is a fact. It's about who discovers the fact by research and shares the knowledge with the help of an example. And certainly someone who is in this job would know better than you or me, plus I didn't speak his tongue. I understood what he's sharing and find it sensible enough to share the valuable information.
Louis7777 wrote: Wed Jun 15, 2016 4:10 pm
Rhino.Freak wrote: Wed Jun 15, 2016 4:01 pm If there's just one class, the speed would be same wouldn't it?
To my knowledge no. The browser has to make sure that there aren't any other classes. With an ID it just stops looking.
Doesn't a browser just reads selectors from left to right? I'm not sure if there are other factors it considers, I could be wrong and I would love to know. And if there is just a single ID written or single class, it should do the same effort as it encounters a opening curly bracket afterwards?
Louis7777 wrote: Wed Jun 15, 2016 4:10 pm
Rhino.Freak wrote: Wed Jun 15, 2016 4:01 pm Regarding your second point. Yes finding anything with "id=" or "#something" will be faster but if we write class names properly, there's really no real need of IDs.
There you go.
Elaborate on that.

Do you imply using specificity in the class name? ;)

What I also said is that if you change the class for an associated element in a template, then you have to make sure that no other elements - in the same or other templates - have been affected.
Like I said, we are starting to make a new style from scratch. If we write classes carefully and in an organized way (like using BEM), we wouldn't face any such issues.
We can avoid using IDs, and so far I haven't seen a good reason to use it other than it being easier to find in the code.

User avatar
Louis7777
Registered User
Posts: 394
Joined: Fri Apr 04, 2014 12:32 am

Re: New Style for phpBB 3.3 ?

Post by Louis7777 »

Rhino.Freak wrote: Wed Jun 15, 2016 5:18 pm A fact is a fact. It's about who discovers the fact by research and shares the knowledge with the help of an example. And certainly someone who is in this job would know better than you or me, plus I didn't speak his tongue. I understood what he's sharing and find it sensible enough to share the valuable information.
A fact is a fact, but I don't see any such facts - do you?

You don't know my job, and I don't know yours (or your experience - to say that someone else knows better).

What I do know though, is that you don't provide any knowledge of your own.
You just take that guy's article for granted and spread it as the correct way to do things.
Rhino.Freak wrote: Wed Jun 15, 2016 5:18 pm Doesn't a browser just reads selectors from left to right? I'm not sure if there are other factors it considers, I could be wrong and I would love to know. And if there is just a single ID written or single class, it should do the same effort as it encounters a opening curly bracket afterwards?
No. From right to left.
Rhino.Freak wrote: Wed Jun 15, 2016 5:18 pm Like I said, we are starting to make a new style from scratch. If we write classes carefully and in an organized way (like using BEM), we wouldn't face any such issues.
We can avoid using IDs, and so far I haven't seen a good reason to use it other than it being easier to find in the code.
You haven't really explained why we shouldn't use them.

Rhino.Freak
Registered User
Posts: 48
Joined: Thu Dec 24, 2015 10:47 am

Re: New Style for phpBB 3.3 ?

Post by Rhino.Freak »

Because classes are reusable. Meaning (if done properly) lesser code and smaller size of the whole package.
And if say you gave some element and ID as well as class and associated some style to ID and class both, it may very well happen that they have some clashing elements and ID will always be given preference.
A short example thingy
<div id="logo" class="header-item left">
And you have something like
#logo {... text-align:center; }
And
.left {text-align: left;}
It's a bad writing but such mistakes do happen.

And you haven't really provided any real reasons to use them either. So I don't really know why you're against this practice so much.

User avatar
Louis7777
Registered User
Posts: 394
Joined: Fri Apr 04, 2014 12:32 am

Re: New Style for phpBB 3.3 ?

Post by Louis7777 »

1. Even the author of the article that you referenced does not account for reusability as an argument:
One argument against using IDs is that they can’t be reused, but to my mind this is a weak argument. The whole point of using an ID is that it’s unique; if you want to reuse something you’d use a class. Developers know this, developers aren’t stupid so to tell them not to use an ID because it’s not reusable is, in my opinion, quite patronising.

Also, some things just can’t be reused. Some designs would be wholly impossible to have, say, two content areas in. You couldn’t reuse that even if you wanted to.
2. No, IDs won't be given preference. Inline style will always be given preference and also whatever comes last in order in the external stylesheet will override the previous rules in it unless there was an !important keyword in present.

3. The writing won't be bad because it is done by phpBB developers. It's more important to consider making the work of style authors easier and faster.

4. I've given reasons. Take a look again here and here.

So Iikewise I don't know why you support that practice which doesn't seem to offer any advantage.

Rhino.Freak
Registered User
Posts: 48
Joined: Thu Dec 24, 2015 10:47 am

Re: New Style for phpBB 3.3 ?

Post by Rhino.Freak »

Okay. What's the use of unique elements and how can you not utilize them by using unique classes? Just curious.

Also
and also whatever comes last in order in the external stylesheet will override the previous rules in it unless there was an !important keyword in present.
No. Just check this little thing I wrote.
http://codepen.io/RhinoFreak/pen/PzzppN
Even if we were to use html body.apple it won't be able to override ID's style.
Inline style does override but how often is it used anyway? It's not a good practice to use those as again, not reusable, overrides everything, unorganized (keep css separate and html separate is more organized).
Also you mention speed of the browser but I still think it'll be same. Please link me to some info source where it says ID is faster.

I do know at the end of the day it boils down to preference and the guy coding knowing what he's doing but your reasonings to use them isn't something that you can only do by ID.

User avatar
Louis7777
Registered User
Posts: 394
Joined: Fri Apr 04, 2014 12:32 am

Re: New Style for phpBB 3.3 ?

Post by Louis7777 »

Rhino.Freak wrote: Wed Jun 15, 2016 7:52 pm [...]
It can be overridden even without !important. Do it like this:

Code: Select all

<div id="banana" class="apple"><span>banana and apple</span></div>

div {padding: 50px}
#banana {color: red; }
.apple span {color: green; }
Please for the sake of this discussion stop using reusability as an argument.
I've told you already that even the author you referenced doesn't support it.

Also, don't give me homework to do. Educate yourself on your own.
You will find out that ID is faster although the difference is insignificant for just one ID versus a Class.

The weight of proof is on you not on me. I won't do the heavy work here by digging in my books and sources.

I've asked about the advantages regarding your claim and you bring up reusability again and again.

Rhino.Freak
Registered User
Posts: 48
Joined: Thu Dec 24, 2015 10:47 am

Re: New Style for phpBB 3.3 ?

Post by Rhino.Freak »

lol you're not even targeting the same element there. What kind of example is that? Will you not just accept the fact that what I said about ID being the one that overrides classes by all means?
And if you claim that ID is faster, give sources for your claim and do not pull it out of someone's rear, really. Whining without proving something isn't going to get you anywhere. How is the weight of proof on me lol?
You can't tell someone "Earth is flat" and when asked of the proof say "Educate yourself", that's by far the weakest argument I've ever seen.
If done properly, classes are a superset of IDs and if you disagree please post some sources for your information and don't give ask me to do the research for it. It really feels like you're just arguing for the heck of it.
You have provided equal degree of arguments for using IDs as compared to what I have provided for not using them.
Plus you still can't answer what can't a class do that ID can't.
The only real use of IDs are
1. Anchors
2. Get element by ID I.e JavaScripts.
No need to use them for styling, at all.

Locked