1

Does anyone know how I can access the standard CSS styling that SFDC uses for a record's edit page? I used pageBlock, pageBlockSection,a dn pageBlockSectionItem tags to mimic the styling, but I'm running into limitations in other areas that require me to now use HTML tables. I'd like to create those tables to mimic the same CSS styling. Any ideas? Thanks.

1
  • Please be specific when asking you need custom CSS of SFDC and specify you cant use standard tags Nov 19, 2015 at 19:09

1 Answer 1

0

This is a tough path to go down. The best case would be to use apex elements. That being said, there are tons of use cases where you just need to write your own HTML. While it is more work, my suggestion would be to create your own stylesheet that mimics Salesforce styling. Trying to directly access their styles leaves you very prone down the road as Salesforce updates its styles. There are a number of other advantages to creating your own stylesheet for the pages:

  • You can take the parts of Salesforce styling that you like, but tweak elements that you do not.
  • If you are having to write your own HTML, it is probably the case that there is not a direct translation from the Salesforce styles to your use case. This gives you an option to tailor the page for your end users.
  • You can easily tweak styles as you get feedback from your end users.
  • Use LESS or SASS to create your stylesheet and maintaining it becomes a breeze.
2
  • Thanks. I actually am trying to re-create their styles using my own. The trouble I am having to determining their elements. I'm using the Chrome inspect elements, but it's rather tedious. I was hoping there was a central repository somewhere that I could mimic as necessary.
    – J. Neilan
    Nov 19, 2015 at 19:35
  • In my opinion, the HTML generated by many apex tags like pageBlock is pretty rough (they love their nested tables). CSS is so incredibly flexible that I think your best bet is to make the best HTML for your use case, then style it up. Depending on the browsers you need to support, using a more modern layout like flexbox (developer.mozilla.org/en-US/docs/Web/CSS/…) becomes a good option.
    – dsharrison
    Nov 19, 2015 at 19:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .