Please read and follow the COMMON ISSUES first!
Always add your version information in every new post! Thank you!

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. john blackwell
  2. Form2Content Lite & Pro
  3. Monday, 10 September 2018
  4.  Subscribe via email
Hello I am having issue when trying to call out a class within the template.

Here is sample of the template and CSS of what I am trying to do:

Template:
{if $TYPE_OF_FOOD_TEXT eq 'Pasta'}
<p class="type_food">This is a Pasta Dish

{/if}

{if $TYPE_OF_FOOD_TEXT}
{$TYPE_OF_FOOD_TEXT}
{/if}


Custom CSS (within joomla template, tried a couple of ways):

.type_food {
background-color:yellow;
}

div.type_food {
background-color:yellow;
}

#type_food {
background-color:yellow;
}

.type_food {
background-color: #f4e842;
}

div.type_food {
background-color: #f4e842;
}

#type_food {
background-color: #f4e842;
}




======================


I have tried multiple ways to call out CSS and tried a few ways to set up the template but none of the ways I try work with the CSS I am trying to use. The correct text words do show in submitted article just not the custom CSS.

Is the custom css settings file supposed to be added somewhere else and not the joomla template custom.css file?
Responses (3)
Accepted Answer Pending Moderation
Hi John,

It seems that this is a CSS knowledge question, not a Form2Content related issue. Your template code is fine by the way.

As you call a class the # won't work since it's for ID's.
Your CSS might work but be "overruled" by the template CSS. Have you used the inline code editor of your browser to see which CSS is applied to the elements?

You could try it here too: https://www.w3schools.com/cssref/tryit.asp?filename=trycss_background-color

If all else fails you could use this too:

{if $TYPE_OF_FOOD_TEXT eq 'Pasta'}
<p class="type_food" style="background-color:yellow;">This is a Pasta Dish</p>
{/if}

Hope this helps!

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. Form2Content Lite & Pro
  3. # 1
Accepted Answer Pending Moderation
Thats works good with the inline above.
Is there a certain place form2content saves all of its CSS code. Such as class="f2c_field f2c_title"

As if there is I would like to try and just add css to that file as I would like to keep the template as short as possible with less code on it. As well for ease of management if i have multiple f2C templates that will use some same css classes I create.

But when I use the class="type_food" that I am trying to use inside of my sites custom.css file it works for other parts of the site it is applied to just not when I try to call it from within a f2c template. Could the rendering process possibly affect this and only look for css code from a certain location?
Accepted Answer Pending Moderation
Hi John,

F2C doesn't generate CSS in the front-end. The Joomla article is fully styled by your Joomla template and any custom code should go into the custom.css as not to be lost during an upgrade of the template. custom.css is loaded on all pages and should have proper naming structure for the css.

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.