How do I change the color of span inside a button inside another span

span inside span
span css
span class
html span width
span class css
span style=font-size
span style bold
<span>*</span>

I have a code like this:

<span class="no1">
<button class="num1"><span class="abc"></span></button>
<button class="num2"><span class="abc"></span></button>
</span>
<span class="no2">
<button class="num1"><span class="abc"></span></button>
<button class="num2"><span class="abc"></span></button>
</span>

Now, I want to change the color of span with class abc, inside class num1 button, inside class span no2

I tried $(".no2").children('.num1').css('color', 'orange')


According to your Question you want to change the color of the span class="abc" element which is inside span having class="num1" and span class="no2"

$(".no2 .num1 .abc").css("color","orange);

In jQuery $(selector nextSelector) reprents the $("ancestor descendant" )

A descendant of an element could be a child, grandchild, great-grandchild, and so on, of that element.

HTML/CSS font color vs span style, How do I change the color of a span in HTML? Given an HTML document and the task is to change the text of span element. There are two property used to change the content. HTML DOM textContent Property: This property set/return the text content of the defined node, and all its descendants. By setting the textContent property, the child nodes the removed and are replaced by a single text


Just to piggy-back on Sushil's answer querySelector mimics this behaviour if you ever decided to ditch jQuery.

const b = document.querySelector('.no2 .num1 .abc');
b.classList.add('blue');
.blue { color: blue };
<span class="no1">
<button class="num1"><span class="abc">test1</span></button>
<button class="num2"><span class="abc">test2</span></button>
</span>
<span class="no2">
<button class="num1"><span class="abc">test3</span></button>
<button class="num2"><span class="abc">test4</span></button>
</span>

Can you have a <span> within a <span>?, the style of a particular region. And as a 3rd option - or last resort rather - I'd use CSS in the tags themselves (Inline CSS). Span tag is a paired tag means it has both open(<) and closing (>) tag and it is mandatory to close the tag. The span tag is used to grouping of inline-elements. The span tag does not make any visual change by itself. span is very similar to the div tag, but div is a block-level tag and span is an inline tag. Tag is written like: Syntax:


You could select the element using jQuery as so:

 $(.no1 .num1).first().css( "background-color", "red" );

Please find this fiddle: https://jsfiddle.net/jega1syb/#&togetherjs=bVGaanQ61z

How do I set span background-color so it colors the background , How do you put a background color in a span tag? 1. Type "style=" within an HTML button tag to change the button style with plain HTML. 2. Type "background-color:" followed by a color name or hexadecimal code within the style section of your HTML button tag or CSS followed by a semi-colon. 3.


Does height and width not apply to span?, How do I change the width and height of a span in HTML? Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML.


span Tag, The HTML span element is a generic inline container for inline elements and content. example inside paragraph applying three times span tag with different style. in this example GFG will be changed “GeeksforGeeks” after clicking on Button. selected text to change, keeping all the other elements around them same. Use HTML DOM Style backgroundColor Property to change the background color after clicking the button. This property is used to set the background-color of an element. Example: This example changes the background color with the help of JavaScript. filter_none. edit.


How to select a span inside a span with CSS? - HTML & CSS, It's a joomla menu and I'm trying to style a span which resides inside a span the inside span, which I assume requires a different selection with CSS. .separator span:first-child { background-color: #5C6888; color: white;  by Ashwini Sheshagiri Buttons have become an inevitable part of front end development. Thus, it is important to keep in mind a few things before you start styling buttons. I have gathered some of the ways of styling buttons using CSS. You can combine most of the methods in order to create a new style, too. To create CSS for gradients, you may use https://uigradients.com. A simple “Get