How do you align a user picture in views with other fields in a global text field?

Comments

markconroy’s picture

You'll have to use a little css, something like

.views-view-myviewname-image img {
float: left; // or right, depending on effect you want
margin-right: 10px;
}

============

Drupal Core Maintainer for "Out of the Box" Initiative.

sp09’s picture

I was thinking there was an easier way to do it inside the field without using css.

[picture] by [name] - [created]

The only thing I found in firebug that I assumed would change the user picture in views was the code below

views-field views-field-picture

I tired applying css to it but nothing changed. I don't see anything in firebug that resembles your example code

hbergin’s picture

Have you looked at using table tags <table><tr><td> within your global text field?

OR perhaps not using a global text field at all and marking the separate fields inline, in field settings? With this option you could use rewrite results to add the "by" and " - " to the chosen fields themselves.

sp09’s picture

I tried it, but it didn't work.

markconroy’s picture

What is in your global text field? Can you copy the contents to here for us?

============

Drupal Core Maintainer for "Out of the Box" Initiative.

sp09’s picture

Global text

[picture] asked by [name] - [created]

markconroy’s picture

Add something like this:

<div class=views-myviewname-wrapper">
<div class=views-myviewname-picture">[picture]</div>
 asked by <div class=views-myviewname-name">[name]</div>
 -<div class=views-myviewname-created"> [created]</div>
</div>

Then in your css file, add something like this:

.views-myviewname-picture {
  float: left;
  margin-right: 10px;
}

You can add more css for the other selectors that I put in above.

Hope that helps.

============

Drupal Core Maintainer for "Out of the Box" Initiative.

sp09’s picture

I tried it, but it did not work.

markconroy’s picture

<div class=views-myviewname-wrapper">
<div class=views-myviewname-picture">[picture]</div>
asked by <div class=views-myviewname-name">[name]</div>
-<div class=views-myviewname-created"> [created]</div>
</div>

Should read

<div class='views-myviewname-wrapper">
<div class='views-myviewname-picture">[picture]</div>
asked by <div class='views-myviewname-name">[name]</div>
-<div class='views-myviewname-created"> [created]</div>
</div>

============

Drupal Core Maintainer for "Out of the Box" Initiative.

sp09’s picture

where do you put this code at? In the page.tpl.php?

markconroy’s picture

Put the first part in your global text area in views, replacing what is there and put the second part in your css file.

============

Drupal Core Maintainer for "Out of the Box" Initiative.