A confusion i have about HTML "classes" [closed] - html

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Hello and thanks in advance. In HTML I know that a "class" will not really have an effect unless it is related to something in CSS or JS. At the same time, I find some "classes" that do affect the structure of a documents even without an associated CSS, such as "class="col-md-12" for example. Can someone explain why some classes work independent of CSS? And how to know them.

class="col-md-12" still requires CSS. That is a common class for a framework such as BootStrap. On its own without JavaScript or CSS, a class does nothing besides tell another programmer what an element is for.

The idea of classes ("class=''") and identifiers ("id=''") is part of DOM manipulation. You can put in classes and id's in each of the tags as you desire. Normally, the rule is an independent id for each tag, and a class for each GROUP of identical tags.
To make use of classes, you are required to use CSS, be it at the top of the page, or linked to another page. If you have your CSS at the top of the page, you do not need another CSS page, however most designers will frown from that.
See here for a more in-depth explanation: https://css-tricks.com/the-difference-between-id-and-class/

Related

HTML elements and inline CSS in text fields [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 last month.
Improve this question
I'm trying to find ways to customize a website where I can only edit the content (text and image) via Contentful’s content management interface (the company that developed the website refuses to integrate the corporate identity and style guide and says it "might" be for future versions).
What do you think about adding HTML elements, inline CSS, or even adding style and loading fonts via style elements directly into the text fields? Given that these elements will obviously be in the middle of the body, is this really bad practice in terms of security and SEO (or other)?
Thank you a lot for your time.
I wouldn't say it's bad for security since it's just style (meaning how the users see the website).
Have you thought about linking the style file? It would maybe be a cleaner solution (don't forget you will have to maintain it later, and having it in a clear way will save you a lot of time reading and wondering what you did, so it's better to be clean) than adding everything inline inside body
As for SEO I believe it's more affected by the use of the elements than having the elements. I mean, if you want some content use instead of a tag that resembles by style to a heading.

What is this <lt-mirror> html tag? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
To make the question short, I was playing with the dom, I created a text-area and noticed that an element tagged lt-mirror was generated whenever the user type something. The new element is placed just before the text-area. Couldn't find any documentation about it across the web ?
The lt-mirror tag was generated by an extension called LanguageTool, which target the text-areas and check for writing errors.
Did some research about this and found something! Okay, so the person who wrote this probably did something called custom elements. Rather than having nested, verbose elements for a page feature, you could use a custom element to make it more comprehensive and most importantly reusable!
You can create a custom element made with your classes, own methods, and properties, etc, and use it with the built-in HTML elements.
You can find more info on it here:
https://javascript.info/custom-elements
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
https://developers.google.com/web/fundamentals/web-components/customelements
I guess it's some kind of a custom element.

what are draw backs of using custom HTML tags? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
what are most critical draw backs of using custom HTML tags? I need to create custom HTML5 tags and looked it up and found pros and cons list but now I'm looking for a draw back that might lead to a huge failure. can anyone help me with that please.
By definition a custom tag is an HTML element that its properties are defined by programmers as opposed to the user agent. basically, custom elements provide a tool for programmers to build their own DOM elements. Programmers can always use non-standard elements in their documents, with application-specific behavior added after the fact by scripting or similar, such elements have historically been non-conforming and not very functional. creating a custom element, we can inform the parser how to properly construct an element and how elements of that class should react to changes.
having said that, the biggest drawback is that, simply defining an element doesn’t mean that the element inherits all attributes and properties as you intended. for example if you create a tag, that doesn’t mean that your newly created tag is suppose to act like a button.

What is a semantically correct HTML element for a "statusbar"? [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
I am writing a simple webapp and I need a status bar. Something that updates often to reflect what JavaScript is doing. It will only contain text, short complete sentences, but in the future it might have small informational images. Like, "An error occured" or "Please wait, loading..." or "Player 2 has disconnected". Now, I know how to make one, but my question is:
What is the most semantically correct HTML element to use for this?
Or will I have to resort to a <div> or <span>? If so, which one? I generally avoid those because they seem like a last resort.
Also, the statusbar may be anywhere on the page. Don't base your answer on its location on the page, that's not what semantics is about.
Please support your answer with some sort of official resource (w3, anything) if you can.
Being unable to find any source of information, I'll answer all by myself and defend my position. My answer is: it depends. The direct answer to your question is that there's no element specific for the status.
However, when this happen the solution normally chosen is to use a generic element as <div> or <span> and assign it some semantics. This can be achieved with class and id, as you are well aware. We cannot expect html to be perfectly semantic and cover every case possible. They are trying their best to cover the most common uses.
A very similar case is the <nav>. It was really common to see <div class = "nav"> or similar code in old html. w3 realized of this and changed it to make it more semantic. Maybe/hopefully they'll do the same for all those class = "status" for a <status>, it just hasn't happened yet.
For solving your problem right now: I'd recommend using a <p class = "status"> actually if your code is going to contain only a paragraph, as it seems. It's slightly more semantic than <div> and <span>.

Css id used two times [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I heard that css id can be used for only one element in a page But this is true when we play with script but on presentation alone this is not affecting anything.
presentation Here there is no effect we are able to create things simply(created two div with same id->no effect).
presentation with script activity Here we cannot do anything this is what we know as it can be used only one time.
I know without script we are not going to do anything but i just want to share this things and get other web geeks opinion on this things.
I'm not sure what you're asking or telling us.
It's simply bad form and against spec to use an id twice in the same document, so don't do it.
If you think you want to use multiple ID's what you REALLY want to do is use a class instead.
From the CSS selectors spec:
What makes attributes of type ID special is that no two such attributes can have the same value in a conformant document, regardless of the type of the elements that carry them; whatever the document language, an ID typed attribute can be used to uniquely identify its element.
It does not specify what the UA must do when it encounters such a situation, and as most browsers are very lenient what you propose will most likely be styled correctly. But you will have an invalid document.