3

So I'm using the Views module to list inventory items that include:

  • Name
  • Photo
  • Description
  • Sales document

I noticed that each item in the view is formatted differently because of size of text, image, etc.

Can I force a specific width/height with CSS, or is there an option within views? Here is an example of the situation.

1
  • Link is not working anymore, please update.
    – saadlulu
    Oct 24, 2012 at 20:22

2 Answers 2

0

If you're looking for uniformity across the view, I'd go with a teaser view mode on the nodes. It's under display settings. In view mode, you can control the length of the text that is trimmed, the size of the image,or whether or not you want field labels, or taxonomy terms showing, etc. In fact you can show a completely different set of fields that weren't visible on the default view mode. The upshot of this is the content will display exactly the same across the entire site without having to re-theme it in a block, in a different view, & so on.

0

My recommendation would be as follows:

In your view, do not use any content view mode (teaser or whatever) but fields instead. This provides more flexibility during theming.

In order to nicely and consistently format the image, you'd want to create a fixed-dimensions image style. For this purpose the best option is to use "scale and crop" effect, or use the Manual Crop module to individually crop each image.

Then, in the field formatting dialog, select this style from the dropdown list.

As for styling the fields, you could either provide classes and wrappers in Views UI, or use templatung/theming in the tpl file. To properly scope the and name the file, click on the Theming Information link in the Advanced column of the view editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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