NetTalk Central

Author Topic: Button ID or class for CSS  (Read 1977 times)

rjolda

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
    • Email
Button ID or class for CSS
« on: June 14, 2024, 04:24:34 AM »
Hi
NT 14.21   C11.0.136
I want to be able to identify a button on a form so I can do some css on it.
Here is my button:
<button type="button" name="Button1_3" id="Button1_39ygW" value="Press to Confirm this is the Kiosk you are at" class="nt-flex nt-button nt-button-without-icon confirmKioskButton67 ui-button ui-corner-all ui-widget" data-do="server" data-formproc="a_dropoff_memform">Press to Confirm this is the Kiosk you are at</button>
The id="Button1_39ygW"  has a generated portion which changes with each iteration.  The 'ygW' portion is generated and variable so I can't use this.
The class="nt-flex nt-button nt-button-without-icon confirmKioskButton67 ui-button ui-corner-all ui-widget"  - I probably can use this as the CLASS selector but it is verbose
The  name="Button1_3"  - is unique but name is not a css selector. 
Is my best option to use the class for a selector?
Other options?
Thanks,
Ron

Alberto

  • Hero Member
  • *****
  • Posts: 1869
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Button ID or class for CSS
« Reply #1 on: June 14, 2024, 04:27:57 AM »
You can add a class to the button in the CSS tab and define this new class in your css
-----------
Regards
Alberto

rjolda

  • Sr. Member
  • ****
  • Posts: 314
    • View Profile
    • Email
Re: Button ID or class for CSS
« Reply #2 on: June 14, 2024, 04:38:06 AM »
Hi Alberto,
How and where do I add the class to the button - so far, everything i have tried has not done it. Can you give more specifics please.
Thanks,
Ron

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11232
    • View Profile
Re: Button ID or class for CSS
« Reply #3 on: June 14, 2024, 04:40:14 AM »
>> The  name="Button1_3"  - is unique but name is not a css selector. 

of course it is. You can select on anything in sooo many different ways. Name is an attribute, and you can use attributes in selectors. Specifically;

[name="Button1_3"] {
    /* Your CSS styles here */
    color: blue;
}

attributes are used in selectors using [ and ]

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1869
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Button ID or class for CSS
« Reply #4 on: June 14, 2024, 04:59:19 AM »
see pic
-----------
Regards
Alberto