Score:0

How do I display a view block next to the branding block in the header?

za flag
Mat

I have created a view (Slideshow) containing a Flex Slider slideshow I want to display in the free header region right of and next to the branding block. I'm using the Bartik theme; I was disappointed to learn that seemingly blocks in the header always come out above or below each other. (I'd prefer blocks to overlap partially and use the view as a kind of background, but for now that's another cup of tea.)

I've tried to put the view in the Header region, change the weight for Branding and Slideview, and set them identical, but I cannot achieve it.

Also, I looked for any kind of format/position/size setting for blocks, but this seems to go against Drupal conceptually.

Then I wanted to tweak the block's CSS by adding a float-class similar to this one.

.float-right {
 text-align: right;
 color:rgba(121, 121, 121, 1);
 font-size: 12px;
 font-style: italic;
 position: relative;
 top:-10px;
 }

I cannot find the file to alter.

What am I missing? Any hint would be highly appreciated. (As you might guess, I'm no Drupal-programmer.)

Score:1
de flag

As it's 2022 you really don't want to be using float for layouts - it's hard to control and requires various hacks (like clears) to clean up subsequent element layouts.

If you start off by adding this to your stylesheet:

.region-header {
  display: flex;
}

You'll see straight away that the branding block and your view appear next to each other.

You can then use align-items, justify-content, gap, etc. to arrange and space the elements as required.

Mat avatar
za flag
Mat
That worked like a charm – thx! This is very much appreciated (I simply cannot cast votes yet.)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.