Join

Style the Single Listing Files Block to Look Like a Button

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new CSS code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

By default, this block doesn’t look the best. The good news is we can easily apply custom styling, and in this case, we’re making the files appear as buttons.

  1. Add the Files block to your Listing Type.
  2. Add #fileblock to the Custom Block ID field of the block.
  3. Add the CSS below to your website.
  4. Adjust the colors (e.g., var(-canvas-white)) to your own colors.
/**** FILE BLOCK BUTTON ****/
#fileblock .file-list a {
    background: var(--accent);
    color: var(--canvas-white);
    border-radius: 5px;
    padding: 15px !important;
    text-transform: uppercase;
}
#fileblock .file-list a:hover {
    color: var(--canvas-white) !important; 
    background: var(--accent10);
}
/** FILENAME **/
#fileblock .file-name {
    color: transparent !important;
}
#fileblock .file-name::before {
    content: "View/Download File"; /* Change the text between the quotes as desired. */
    color: var(--canvas-white) !important;
}
/** ICON **/
#fileblock .file-icon i {
    display: none;
}
/** FILE VIEW LINK **/
#fileblock .file-link {
    display: none;
}

The option below is if you’d like to keep the icon that appears before the button text and style it up.

/**** FILE BLOCK BUTTON ****/
#fileblock .file-list a {
  background: var(--accent);
  color: var(--canvas-white);
  border-radius: 5px;
  padding: 15px !important;
  text-transform: uppercase;
}
#fileblock .file-list a:hover {
  color: var(--canvas-white) !important; 
  background: var(--accent10);
}
/** FILENAME **/
#fileblock .file-name {
  color: transparent !important;
}
#fileblock .file-name::before {
  content: "View/Download File"; /* Change the text between the quotes as desired. */
  color: var(--canvas-white) !important;
}
/** ICON **/
#fileblock .file-icon i {
  border: none;
  color: var(--canvas-white); 
}
/** FILE VIEW LINK **/
#fileblock .file-link {
  display: none;
}