Announcement

Collapse
No announcement yet.

access main css variables from a template.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • access main css variables from a template.

    for example, I'm adding a line in the header, and I want it to be the color of the "table header" - "background" color

    I thought this would be simple, but I can't find nothin on it.
    Thanks.
    -

  • #2
    You would set whatever HTML element to have the class attribute as thead.

    For example:

    HTML Code:
    <span class="thead">Whatever in here </span>

    Comment


    • #3
      Sorry if I'm a little dense -- but I'm not getting it big dan....

      the statment I'm working on is below..

      Code:
      <table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center" background=images/blackgrad.jpg>
      so -- I can't access the variable like the $stylevar[outertablewidth] variable?

      the one I'd like to change to use a variable is the blackgrad.jpg in the background=
      -

      Comment


      • #4
        If you want to change the colour of text that is contained in an image, then you'll need to amend the image itself. <span> and all other tags work on text.
        John

        Comment


        • #5
          Musicman -- you're going the wrong way with what I'm trying to do..
          I'm not trying to change the color, but use the existing color in another table.
          I am adding a small table in a template, and I want to pull the info that is already assigned to table header background in the CCS form.
          -

          Comment


          • #6
            Hmmm OK. All the CSS elements should be available to you. What class are you wanting to use in your new table, and in what template is this going to appear in. Reason I ask is that I can then test out on my localhost for you.
            John

            Comment


            • #7
              on the main CSS page -- it's the table header - background color
              and the template I'm adding this to is header --
              If I can just figure out what the name of the variable is, I can do it, no problem.
              -

              Comment


              • #8
                OK, so let me see if I fully understand what you are trying to do. You want to add a line of text into the header template somewhere that uses a font colour that is the same as the table header class background colour?

                If so... then you will need to do this;

                1 - look at the "thead" class in the AdminCP for that style, and obtain the hex value of the background colour - say it's called 123456
                2 - use this code in your header template where you want the text to appear;
                Code:
                <span style="color: #123456>Your text here</span>
                Hope that helps...
                John

                Comment


                • #9
                  That is exactly what I want to do, only without hard-coding the color

                  I have 5 different styles setup, and instead of hard-coding the color in each header template, I want to make a change in the parent template, and add the variable, so the background color on the table I'm adding changes with each style

                  All I need to know is the variable used for that field.
                  -

                  Comment


                  • #10
                    I am not a CSS expert but I am sure that once you assign a class to a div, span or td, you cannot use the background of that class as the font colour of that class unless you make them the same (which would defeat the object somewhat eh)

                    What you can do though is to make and install a new class in the parent style which will then be used throughout all child styles. Add this class to your parent;

                    Code:
                     .my_class {
                    color: #123456;
                    }
                    ... and where you want to include the text in this colour in header template, use;

                    Code:
                    <span class="my_class">Your text here will appear in colour 123456</span>
                    John

                    Comment


                    • #11
                      unfortunatly that is not what I'm after -- in your example -- the background color would be the same in all styles --

                      the point of what I am trying to do is to have the table I am adding match the table colors of the thread headers, without hardcoding the colors in each style --

                      I can't believe that variable is not available to use, oh well, Guess I'll just hard code the colors and be done with it.
                      -

                      Comment


                      • #12
                        Originally posted by svoec
                        unfortunatly that is not what I'm after -- in your example -- the background color would be the same in all styles --

                        the point of what I am trying to do is to have the table I am adding match the table colors of the thread headers, without hardcoding the colors in each style --
                        svoec,

                        I know what you mean, I've been searching for this as well.

                        I've got a menu bar on the right hand side of my forum, but my forum has 4 different styles to choose from. It'd be nice if I could make one template that uses $stylevar(BACKGROUND_COLOR) or whatever and be done with it. Instead I've got to hardcode each side bar with a different background color and so on.

                        If I find anything I'll be sure to let you know.



                        -Michael
                        Debt-Made-Easy.com: Get out and stay out of debt.

                        Comment


                        • #13
                          Is this really impossible without hard coding colors? I find it hard to believe...

                          Comment


                          • #14
                            If I understand you correctly then you can do what TheMusicMan said. You can then define this class seperately in each of the styles.
                            Best Regards
                            Colin Frei

                            Please don't contact me per PM.

                            Comment


                            • #15
                              Originally posted by Colin F View Post
                              If I understand you correctly then you can do what TheMusicMan said. You can then define this class seperately in each of the styles.
                              If you go here, you can check what I need. You can see that on the bottom of each post there is a small color bar with a linked news from our website. I want that color bar to be colored with the color from the background color of the .tfoot class, so that it will change automatically for every style. Otherwise... everytime I need to change something in the additional CSS definitions... I need to re-hardcode the colors for every style.

                              At the moment, that bar is defined by this class in the extra CSS portion of each style, the red line is the one I'd like to modify dynamically:
                              Code:
                              .newslink
                              {
                              background: #2968B5;
                              color: #FFFFFF;
                              font: bold 10px tahoma, verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
                              text-align: center
                              }
                              .newslink a:link
                              {
                               color: #ffffff;
                               text-decoration: none;
                              }
                              .newslink a:visited
                              {
                               color: #ffffff;
                               text-decoration: none;
                              }
                              .newslink a:hover, .tcat a:active
                              {
                               color: #FFE100;
                               text-decoration: underline;
                              }
                              .bordernewslink
                              {
                              border-width: 0px 1px 1px 1px;
                              border-style: solid solid solid solid;
                              border-color: black black black black;
                              }

                              Comment

                              Related Topics

                              Collapse

                              Working...
                              X