NetTalk Central

Author Topic: Apply CSS directly to a field  (Read 2201 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Apply CSS directly to a field
« on: September 25, 2012, 04:01:51 AM »
NT 6.42
I have a Form (table) that has a display string that I wanted to change the font size for just that string on just that form.  It is the only field in the entire application where the default CSS settings don't apply.

I was thinking that I could just use the CSS tab for that field to enter the font change.  Here is what I entered in the CSS Class field on the CSS tab for that field:

'font-size:16px;'

I saw no change in the display (the default settings is 12px).  The actual generated code was this:

<div id="displayfaq_faq__question_value_div"  class="nt-form-div"><div class="font-size:16px;">How do I Order?</div>


I thought is was possible to do a simple CSS injection in this way, where it was not going to be used anywhere else, so it was simpler to do it this way rather than add a CSS to the custom.css file.

What am I doing wrong, or is this even possible?
Thanks,
Mike Springer



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Apply CSS directly to a field
« Reply #1 on: September 25, 2012, 05:27:04 AM »
Hi Mike,

the absolutely, positively, correct way to do this is;

a) add a class to your custom.css file

.whatever{
font-size:16px;
}

b) in the template set the field to use css class
' whatever'
(not the leading space, which you probably want)

I know this seems like the long way around, but just do it right - you'll thank me later.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Apply CSS directly to a field
« Reply #2 on: September 25, 2012, 05:56:18 AM »
You are always right, and I always end up thanking you later!
Thanks for your direction.
Mike