1

What are the possible ways one can style a View (Block) in Drupal 7? I have a View outputting to a Block on a Drupal 7 site that has custom styles which I need to copy; however, I cant seem to find where they are located.

1

The possible ways are:

1) using a CSS file, ex: style.css (located in your /sites/all/themes/YOURTHEME/css folder)

.block { border: solid red; }

2) using jQuery, ex: style.js (located in your /sites/all/themes/YOURTHEME/js folder)

$('.block').css({"border":"solid red"});

3) using a template file, ex: block.tpl.php or view.tpl.php (located in your theme's /sites/all/themes/YOURTHEME/template folder)

<style>
.block { border: solid red; }
</style>

4) Inside the view, if they add a header or footer of text area or unfiltered text and then put inside the header/footer:

<style>
.block { border: solid red; }
</style>

or

<script src="myScript.js"></script>

5) Using the CSS Injector module

6) Using the JS Injector module

  • Are there any ways that are located within the Block or View editing screens? – MadPhysicist Dec 5 '16 at 16:59
  • @MadPhysicist yes, they could've added a header or a footer that contains the css. – No Sssweat Dec 6 '16 at 1:35
  • @MadPhysicist if you provide me a link to your view, I am sure I can quickly pin point were it is coming from. – No Sssweat Dec 6 '16 at 1:37
  • As in the page with the view? Does it matter if the view in question is done as a Block? – MadPhysicist Dec 6 '16 at 2:16
  • 1
    I was able to resolve it. Looks like it had to do with the way the Block was formatted (Table, List, etc) rather than styling directly. Thanks for the help! – MadPhysicist Dec 6 '16 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.