HTML5 <br> tag , can have attributes? - html

w3schools say that ("All HTML elements can have attributes"). so, can br tag have attributes?
w3schools

You can still use br tag element to specific the id or any other css style, or custom attribute, and the modification you could use on either JavaScript or even on the size you broke the line.

Br tag supports global attributes and event attributes.
Global attributes :- https://www.w3schools.com/tags/ref_standardattributes.asp
Event attributes :- https://www.w3schools.com/tags/ref_eventattributes.asp

Related

Can we make our own tag in html

I want to create my own tag such as
<store></store>, <market></market>
It's possible, check out > Is there a way to create your own html tag in HTML5?
But it would cause your HTML to become invalid.
A custom tag serves the same purpose as a tag - it has no direct attribute and does nothing by default, but it can be styled by HTML and accessed by javascript.

Can custom attributed be added to anchor tags?

Can custom attributes be added to anchor tags? Example:
Link
Are there any compatibility/performance concerns between different browsers?
You should use the data-* attributes for that.
Like:
Link

Can empty HTML elements have attributes in HTML5?

Empty HTML elements (i.e. elements having no content and no closing tag, like br/hr or any other HTML elements which I'm not aware of) can have attributes in the latest HTML5 standard?
Somebody please explain me in simple and easy to understand language.
Yes. Example: The <hr> tag can be modified to move the line around or change its length.
<hr width="50%" align="right">
They can For example tag supports global HTML attributes. You can check the attributes of html tags in W3school site. Here is the one for br:
http://www.w3schools.com/tags/tag_br.asp
(Check out the Global Attributes and/or Event Attributes)
You can easily check yourself which attributes an HTML5 element can have. In short:
Visit the HTML5 specification.
Search for the element under the "Table of Contents" (section 4).
For each element, see the attributes listed under "Content attributes".
In case of br and hr, they can have the global attributes (class, id, lang etc.).

Which HTML tags can have a title attribute?

I know <th>, <a>, <p>, <h1>…<h5> can all use title attributes. Which other tags can use them?
I'm currently optimising a website for SEO purposes by adding title attributes with keywords associated with the website
The title attribute works with all HTML tags. It's a global attribute. You can see the list of all HTML tags here.
http://www.w3schools.com/tags/ref_standardattributes.asp
The title attribute can be found in the global attributes section of the HTML 5 recommendation which says:
The following attributes are common to and may be specified on all HTML elements (even those not defined in this specification)

P attribute inside <li> tag

I have seen this code from the tutorial that I'm studying. I searched for the purpose of the p attribute inside the li tag but found no answer. What is the purpose of that p attribute inside the li tag?
$msgs .= "<li p=\"$no_of_paginations\" class=\"inactive\">Last</li>";
The purpose cannot be inferred from the code snippet. As such, the attribute, being not defined in any HTML specification or draft or browser-specific extension, has no effect beyond being stored as data into the p element node in the document tree.
Such an attribute, though invalid by the specs, can be used like any other attribute in styling (e.g. attribute selector .p) in CSS or in scripting. In this case, it is probable, but by no means certain, that the attribute is meant to be used in scripting to carry a number as its value, with that number inserted with some server-side code, so that this value can be accessed in client-side scripting, as relating to a specific element.
The recommended way is to use data-* attributes instead, such as data-p, to avoid any risk of clashing with attribute names that might be introduced in some future HTML version.
The default HTML(whichever version) namespace doesn't have a purpose for "p" inside a li tag. If there's another namespace declared then that's where it's from. Other than that, it's not valid by w3 standards.
It should be a custom attribute to use in JavaScript codes to get something.
That is just a custom tag used in some javascript functions