Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Custom CSS Class Problem

Custom CSS Class Problem

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 68 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    robochicken
    wrote on Mar 9, 2022, 9:30 PM last edited by robochicken Mar 9, 2022, 4:32 PM
    #1

    Hey Laytheme Community,

    I feel kinda stupid about this, but somehow it seems i miss something really essential here. I searched the forums for a solution but couldnt find it yet.

    I want to give a textframe a black background.

    From my understanding, I would give a text frame a CSS class and adjust the background color using that class.

    However, if I apply the custom CSS class it doesnt seem to do anything. Using the inspector, I also cannot see the CSS class.

    What am I doing wrong here? I am pretty sure the CSS class name should be unique.

    Find the Testpage here: https://richardlennox.de/customcss

    Thanks in advance for any hints and sorry for the superbasic problem.

    Screenshot 2022-03-09 at 22.25.02.png

    Screenshot 2022-03-09 at 22.25.10.png

    Screenshot 2022-03-09 at 22.25.39.png

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Richard
      Global Moderator
      wrote on Mar 9, 2022, 9:51 PM last edited by Richard Mar 9, 2022, 4:53 PM
      #2

      Dear @robochicken

      "sorry for the superbasic problem."

      No worries! we are all learning 👍
      You can set a class or ID for your element: myclassblackbg .

      But how do we really know if it's a class or an ID?

      We fix this with CSS Selectors
      When we define the CSS, we also need to define if this myclassblackbg is a Class or ID (or attribute etc).

      myclassblackbg is a Class = We use the selector .
      If myclassblackbg was an ID = we would use the selector #

      You can see a list of selectors here:

      https://www.w3schools.com/cssref/css_selectors.asp

      Therefore you CSS :

      myclassblackbg{
          background-color:black;
      }
      

      needs to be ( the . in front to define it's a class ):

      .myclassblackbg{
          background-color:black;
      }
      

      https://laytheme.com/documentation/custom-css-styling.html


      Hope this helps @robochicken Have a wonderful day ✨
      Richard
      1 Reply Last reply
      1
      • R Offline
        R Offline
        robochicken
        wrote on Mar 9, 2022, 10:04 PM last edited by
        #3

        Thank you big time for the thorough feedback.

        That did exactly what I wanted and I learned a valuable lesson :)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Richard
          Global Moderator
          wrote on Mar 9, 2022, 10:20 PM last edited by
          #4

          Have a great day @robochicken thanks for supporting Lay Theme !!

          1 Reply Last reply
          1
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes

          3/4

          Mar 9, 2022, 10:04 PM


          I also code custom websites or custom Lay features.
          💿 Email me here: 💿
          info@laytheme.com

          Before you post:
          1. When using a WordPress Cache plugin, disable it or clear your cache.
          2. Update Lay Theme and all Lay Theme Addons
          3. Disable all Plugins
          4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

          This often solves issues you might run into

          When you post:
          1. Post a link to where the problem is
          2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
          3. If the problem is difficult to explain, post screenshots / link to a video to explain it
          Online Users
          Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
          laytheme.com
          • Login

          • Don't have an account? Register

          • Login or register to search.
          3 out of 4
          • First post
            3/4
            Last post
          0
          • Recent
          • Tags
          • Popular
          • Users
          • Search