Skip to content

Issue with text with gradient overlay and text line paragraphs tied to the same container div without a wrapper div #18

Description

@acsr

The construction of the text overlay DOM makes it almost impossible to change the text alignment of both lines to the bottom of the image by CSS only.

Gradient overlay and text line paragraphs tied to the same container div without a wrapper div share also the 50% width limitation used to style the extension of the gradient and limit the text at the same time.

With the below solution the issue is using position: absolute; on the div you get always the p elements inline.

I tried:

.block.banner .text {
  display: flex
  p {
    align-self: flex-end;
  }
}

or

.block.banner .text {
  display: flex
  align-self: flex-end;
}

I would suggest to put the gradient on a wrapper div positioned absolute and wrap the lines / p in a seperate div decoupled from the order inside the gradient div itself.

Given the impact of the width on the gradient, even another construction is maybe better.

For example a light diagonal gradient is a variant that makes sense:

background: linear-gradient(15deg, #000, transparent 40%);

You can use the percent value on transparent to control where the full transparency starts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions