in case you using SASS: you can use this snippet and change accordingly
$colors: red, orange, yellow, green, blue, purple;
$repeat: 20 // How often you want the pattern to repeat.
// Warning: a higher number outputs more CSS.
@for $i from 1 through $repeat {
.gallery img:nth-child(#{length($colors)}n+#{$i}) {
border-color: lighten(nth($colors, random(length($colors))), 20%);
}
}
.gallery img {
list-style: none;
padding: 1em;
}
if you can’t work with SASS than you must use a javascript / jquery solution to achieve that. I posted a snippet that generates random color values. now you only need to find a logic to get the colors to the appropriate items.
var color = "#" + Math.floor(Math.random() * 0xFFFFFF).toString(16);
If you need further help, post some more code
Related Posts:
- How to specify a class added to my gallery
- Gallery CSS Problem
- Only column gallery on mobile device
- Why does my caroussel gallery do this in responsive? [CSS] [closed]
- “Scattered” gallery
- CSS styling of native (inbuilt) wordpress thumbnails [closed]
- How to edit wordpress native gallery’s css file?
- Customize Bootstrap checkboxes
- Is there a CSS parent selector?
- What is WebKit and how is it related to CSS?
- Is there a color code for transparent in HTML?
- How can I center an absolutely positioned element in a div?
- How to override the properties of a CSS class using another CSS class
- css transition opacity fade background
- Text-decoration: none not working
- Aligning two divs side-by-side
- CSS transition shorthand with multiple properties?
- How to center HTML5 Videos?
- Using custom fonts using CSS?
- Why CSS3 Animation is not working?
- Why is my Bootstrap code not working?
- What is the difference between visibility:hidden and display:none?
- Center a position:fixed element
- How to change the background colour’s opacity in CSS
- How to make canvas responsive
- Disable SSL / HTTPS for wordpress
- Forcing reload of editor-style.css
- How can I make the wordpress editor apply the selected template?
- How do I remove specific styles from the parent theme css using the child theme css?
- What CSS rules are introduced to core blocks through wp-block-styles?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- When using https, wordpress doesn’t use https for CSS and JS, and admin doesn’t work. How do I fix this?
- How to load different css file depending on language
- Can the Theme Customizer be used to generate static/cachable CSS, and how?
- Woocommerce include custom stylesheet after woocommerce styling [closed]
- raw code vs wordpress
- Is there a way to change the backround color of the native video player in wordpress?
- How to create fa-bars animated menu
- footer disappear on some pages frequently
- Changing CSS FilePath for All Pages
- CSS Minification
- wp_add_inline_style breaking style and not working
- show count is out of the anchor tag in wp_list_categories
- jQuery UI styles conflicting with TinyMCE dialog
- Why won’t my custom login page CSS load?
- Display Something in the Header After All Styles are Loaded
- wordpress – site not update after update style.css
- NGINX+wordpress: CSS being served but not applied
- How to apply CSS based on publishing date
- Menu toggle bar works only on some pages in WordPress
- After moving my site, sub-menus are not showing [closed]
- Including CSS files in HEAD based on page content
- Video header on mobile, disappears behind header and content
- Free theme and css/bootstrap.css is not overridden in the child theme
- How to style text in WordPress
- WordPress hide the username/password fields in login page
- Equal height sections in custom Headway Theme
- Superfish and WordPress: Active Color Problem
- Links on the page, when being printed, have the URL next to them
- How do I minify ‘@import’ css files with wp-minify?
- Selector for page to set up scrolling plugin
- Button doesn’t work in the profile panel
- How To Remove All Other Plugins CSS
- Hot reload failing to update file changes
- How can I hide this custom slider while Elementor editing window is open?
- My css don’t get applied on the costume widget
- Stop custom Gutenberg styles taking over other admin bits?
- Change post featured image
- Is there a way to cache mailchimp css on wordpress?
- Removing a CSS rule from Custom Taxonomy
- How to get different html tags from the content using regex?
- style.css not working but customizer additional css does?
- Performance hit of Inline CSS
- Remove top bar header
- How to disable all css from the theme for a specific post type page
- Change WP Child theme CSS for WP Bootstrap Starter Theme
- Divi Theme HTML code is different in View Page Source than in the Firefox Inspector
- use css for resize image into mobile thumbnail
- How to set up workspaces with Chrome & WordPress?
- How to Position Read More link after post excerpt?
- Add WordPress Core CSS into editor-style.css
- CSS in child theme to replace !important in parent theme
- How would I add this code to a single WordPress page?
- WP theme update causes child theme CSS problems
- adding a favicon to site2 – site1/site2/favicon.ico
- WordPress crop image not working [closed]
- How to make CSS load live based on options clicked in the theme customizer?
- Which files can be replaced in a child theme?
- How to implement styling of div in the front end using plugin admin meta box settings?
- How do i make a sidebar background color? [closed]
- How to remove audio player styles added by mediaelement.js JavaScript?
- Do you use css reset in your child theme [closed]
- CSS messes up when CACHE is cleared
- Twenty Fourteen Theme – Moving left sidebar to the right
- WordPress doesn’t respect “ver” parameter in styles [closed]
- why does WordPress custom css convert alpha to hex values?
- Image is very blurry
- how to change the colour of this background
- Can I upload my HTML/CSS/Javascript game onto a WordPress page?
- How to add css to wp_head depending on the user role?