Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an html tag that does not have any effect on an html document?

Tags:

html

tags

In html, is there a tag that I can add an id attribute to, that does not have any effect on the html page, but can still be accessed with a jQuery selector?

Here is an example:

<li><a href="#"><i class='fa fa-link'></i> <span>Another Link</span></a></li>

If I have the above code in a list, what tag can I add to this html, so that I can then use jQuery to perform actions on the code items as children?

The above code is just an example, I am wanting to be able to use this technique for any html element.

EDIT

Is the <span> tag what I am looking for?

EDIT2

I have tried the following with a span tag:

<span id="qwerty123"><li><a href="#"><i class='fa fa-link'></i> <span>Another Link</span></a></li></span>

However, the list items are not being displayed correctly. I am using an AdminLTE template and this template uses custom styling for these list items.

How else can I achieve the desired result? Can I add data attributes or some other html coding technique?

EDIT3

The html tag with the id needs to be before any of the other tags, so that all the rest of the tags can be treated as children.

like image 648
user3736648 Avatar asked Jun 12 '15 04:06

user3736648


People also ask

Is there an HTML tag that does nothing?

What is the html tag that doesn't really do nothing? The <span> and <div> tags signify no specific meaning and are intended only for markup.

Which HTML tag has no attribute?

Answer. Empty elements (also called self-closing or void elements) are not container tags — that means, you can not write <hr>some content</hr> or <br>some content</br> . A typical example of an empty element, is the <br> element, which represents a line break.

Which tag does not have any property of its own?

There are many other tags with their own classes that may have specific properties and methods, while some elements, such as <span> , <section> , <article> do not have any specific properties, so they are instances of HTMLElement class.

Which HTML element that have no content?

HTML elements with no content are called empty elements.


1 Answers

The span tag is indeed what you are looking for: it's the only HTML inline container tag. Unless you apply CSS to it, it's simply an inline tag that doesn't alter the way your document is displayed.

Read this for more details: http://www.w3.org/TR/2014/REC-html5-20141028/text-level-semantics.html#the-span-element

Please also note that you could use a div tag and apply CSS display:inline; to achieve the same result.

Hope this helps :)

like image 161
Alex Domenici Avatar answered Sep 19 '22 15:09

Alex Domenici