Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7582285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:23:55+00:00 2026-05-30T18:23:55+00:00

After some digging around on SO I found this as the best response for

  • 0

After some digging around on SO I found this as the best response for my need of having rounded corners for tables.

Which lead me to the following CSS snippet:

.greytable tr:first-child th:first-child {
    -moz-border-radius-topleft: 5px;
    -webkit-border-top-left-radius: 5px;
    border-top-left-radius: 5px;
}

.greytable tr:first-child th:last-child {
    -moz-border-radius-topright: 5px;
    -webkit-border-top-right-radius: 5px;
    border-top-right-radius: 5px;
}

.greytable tr:last-child td:first-child {
    -moz-border-radius-bottomleft: 5px;
    -webkit-border-bottom-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.greytable tr:last-child td:last-child {
    -moz-border-radius-bottomright: 5px;
    -webkit-border-bottom-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

Now I’d like to know how I could simplify all these with LESS. I tried the following LESS code:

.border-radius (@v, @h, @radius: 5px) {
    -moz-border-radius-@v@h: @radius;
    -webkit-border-@v-@h: @radius;
    border-@v-@h: @radius;
}

And then invoke it (for the top left corner):

.greytable tr:first-child th:first-child {
    .border-radius('top', 'left')
}

But it doesn’t work (error on the second line of the LESS snippet).

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:23:57+00:00Added an answer on May 30, 2026 at 6:23 pm

    You might need to use the string interpolation syntax, try this:

    .border-radius (@v, @h, @radius: 5px) {
        -moz-border-radius-@{v}@{h}: @radius;
        -webkit-border-@{v}-@{h}-radius: @radius;
        border-@{v}-@{h}-radius: @radius;
    }
    

    I would also add that webkit and mozilla are largely up to speed with the standard border-radius property, and the vendor prefixes are becoming outdated for it.


    EDIT: It seems that string interpolation isn’t working out for this task (the above code won’t compile), so here’s a workaround mixin that will actually be easier to use:

    .rounded-table(@radius) {
        tr:first-child th:first-child {
            -moz-border-radius-topleft: @radius;
            -webkit-border-top-left-radius: @radius;
            border-top-left-radius: @radius;
        }
        tr:first-child th:last-child {
            -moz-border-radius-topright: @radius;
            -webkit-border-top-right-radius: @radius;
            border-top-right-radius: @radius;
        }
        tr:last-child td:first-child {
            -moz-border-radius-bottomleft: @radius;
            -webkit-border-bottom-left-radius: @radius;
            border-bottom-left-radius: @radius;
        }
        tr:last-child td:last-child {
            -moz-border-radius-bottomright: @radius;
            -webkit-border-bottom-right-radius: @radius;
            border-bottom-right-radius: @radius;
        }
    }
    

    Usage:

    .greytable {
        .rounded-table(10px)
    }
    

    Output:

    .greytable tr:first-child th:first-child {
      -moz-border-radius-topleft: 10px;
      -webkit-border-top-left-radius: 10px;
      border-top-left-radius: 10px;
    }
    .greytable tr:first-child th:last-child {
      -moz-border-radius-topright: 10px;
      -webkit-border-top-right-radius: 10px;
      border-top-right-radius: 10px;
    }
    .greytable tr:last-child td:first-child {
      -moz-border-radius-bottomleft: 10px;
      -webkit-border-bottom-left-radius: 10px;
      border-bottom-left-radius: 10px;
    }
    .greytable tr:last-child td:last-child {
      -moz-border-radius-bottomright: 10px;
      -webkit-border-bottom-right-radius: 10px;
      border-bottom-right-radius: 10px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was doing some digging around into delegate variance after reading the following question
After some digging around with the Wordpress XML-RPC documentation , it seems that there
After some find and replace refactoring I ended up with this gem: const class
After some stupid musings about Klingon languages, that came from this post I began
After some code review I removed unnecessary properties which resulted in empty rules. So
I'd like to use memcached in my java web application, and after some digging
I wanted to use this gem: https://github.com/PRX/apn_on_rails Finally, after digging through the issues, seems
I love Go, especially the goroutines. They are simple and efficient. After some digging,
After some time I wanted to update my git repo, and then something went
After some years of experience in the field, it seems to me that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.