There are usually multiple ways of doing things because new ways were introduced and the old ways were kept for backwards compatibility to ensure old websites didn’t break. Both ways are usually valid and have their own advantage; for example, the
<b> tag in HTML allow you to easily make a word or sentence bold without having to write any CSS and the CSS style
font-weight: bold allows you to style multiple elements with a specific class.
On a side note, avoid
<b> and use
<strong> instead, but only use
<strong> when you want to emphasise the importance of text. Use CSS to make text bold if it has no significance.
I guess there still exists only one way!
Checking on your example
<b> is HTML’s way of writing bold text and
font-weight: bold is CSS’s way of writing!
your question is not that clear but my answer would be “there are tags in html that you should know, where to use them for example about bold fonts that you say, we have
<b tags for bolding texts, when we wanna emphasize on something that also matters in SEO in order to let google bots to understand we use strong tag”
There are many different ways to write code that have developed historically. But you can find the best way by reading the W3C specifications. And always remember that to scale projects it is better to transfer properties to separate CSS files. That is, in a specific example, it is better not to use tag b at all, but you need to go to the cascading style file and write the properties of the bold font, because if you can have this property of this element written in many web pages, then you will have to run through all pages and look for this item to change it. And if you wrote this property for this element in the cascading style file, then you would be able to quickly fix the element’s properties in the future, if necessary.
Is there a specific reason as to why different ways of coding exists. Such as in website designing for a bold tag you can do the “b” tag or font-weight: bold in css. Does this exist just as an alternative way of doings this or is there a purpose as to why different ways exist?
The reasons are mostly historical, technology evolves, new (and hopefully better) ways of achieving the same (or similar) things are introduced, old ways are deprecated, removed or kept in addition to the new ways.
We shouldn’t confuse the browser’s default approach to styling certain elements with what that element conveys. After all, by default a browser will style