Why is there a float in fields.scss? Messing alignment in node content when inserting media images

Created on 21 April 2023, over 1 year ago
Updated 17 July 2023, over 1 year ago

Problem/Motivation

I haven't been able to justify the use of float: left/right in components/field.scss but it causes troubles when you add media images in node content. Everything gets on the same "line" and eg. it override the specified "align" of the image.

@media all and (min-width: 560px) {
    .node .field--type-image {
        float: left;
...

While I admit I've a very shallow knowledge of css, if I at least could understand why that float is there I could try to think of a fix that doesn't break stuff elsewhere.
Otherwise I'm just going to override field.scss and drop "float" it in my custom theme.

Thanks

💬 Support request
Status

Closed: works as designed

Version

5.5

Component

Code

Created by

🇮🇹Italy azaril Milano

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @azaril
  • 🇮🇳India mukeshMukesh12

    In the Barrio Drupal 8/9/10 theme, the CSS rule .node .field--type-image { float: left; } is used to float the image field within a node to the left side of its container.

    The float property is a CSS property used for positioning elements. When an element is floated, it is taken out of the normal flow of the document and moved to the left or right of its container. This allows other elements to wrap around it.

    In the case of .node .field--type-image, the CSS selector targets an image field within a node. By applying float: left, the image field will be floated to the left side of its container, and other elements (such as text or other inline content) can wrap around it on the right side.

    By using float: left, the image field can be positioned inline with other elements, creating a more flexible layout for the node content.

    It's worth noting that the float property has certain characteristics and can affect the layout and positioning of other elements on the page. To ensure proper alignment and avoid layout issues, it's important to apply appropriate clearing or clearfix techniques to the parent container if necessary.

  • Status changed to Closed: works as designed over 1 year ago
Production build 0.71.5 2024