0

Two questions that I guess are both a part of one bigger idea. When creating a content type, I've been trying to figure out how to both indent a field and create a line break after a field both by default. For indenting I have tried adding spaces before the field name, but because it's empty space they are disregarded and displayed as normal. For the line break, I've tried adding a custom code field with br or p, and simply adding a blank field, but in both situations as there is no text to display, the field is not displayed at all. Any suggestions?

1 Answer 1

1

The safest thing to do is to use the #attributes Form Control Attribute. You can specify a CSS class to target this element to then supply some css rules to indent these elements in your sites theme.

Similarly, you can add a class to add a line break somewhere within the widget markup to create your linebreak. Be sure to notice that the class example in the linked documentation takes a PHP array of class(es) (not a string label for the class) ... that messed me up last week for like 20 minutes.

1
  • Thanks for the help. The only problem is...I am new to both Drupal and to CSS, and have little to no understanding of how to do any of this. I know that it would be best for me to go and learn CSS before tackling Drupal, but this is just the situation I ended up in. So, if you are willing to keep helping me out, what would be the best way to add this CSS, and how would I use it specifically on a designated field? I have installed Display Suite, and noticed that there is a "styles" area within it. Would this be the place to go to apply the CSS?
    – Mrweiner
    Apr 6, 2012 at 17:13

Your Answer

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

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