A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Alignments of images by html and not by styles in css or div-inline-css

Anonymous2292900
2023-03-28

“general problem”

  • One of the general problems when you want to style an image is that you need things like div. For example, things like div usually have style types: inline-css, internal-css or external-css. But images do not.
  • Even when we style images in css, they can often have their styles overridden by the div. This is my general concern, why img are overridden by styles in css?

“possible solution to the general problem”

  • My general idea is to add general attributes on images such that the images are block conditioned.
  • My individual and non-analytical perception on this topic, aims to make the stylization of images directly through html for web developers. In that sense, there would be no need for the image to be overwritten, because it wouldn’t be a style: css.

“individual issues at technical level”

  • I think the idea of using jquery frameworks or plugins for this is unnecessary.
  • No jquery plugins or css frameworks are needed because the HTML (technical specification) includes the img element. In that sense, why should we have something like jquery plugins or css frameworks to align images, when the html itself already has that?
  • But the general point of my discussion here is that even the standardized html, in my scenario it doesn’t work in practice.
  • As I said at the beginning, there is an img element in the html, but the img element in the html has few attributes, that is, it is not as semantic as it should be.
  • That is, it turns out that what makes the image more semantic is the css style, and that as I said at the beginning, this is problematic. because styles can replace certain positions of images.

“technical fact problem”

  • My general problem with the current html or css spec is that the img element doesn’t have a “type” attribute in html.
  • I say that my general problem with the current specification of html or css, because the way I use these two technologies seems confusing, not didactic, logical, accessible.
  • When I say “I use these two technologies it seems confusing, not didactic, logical, accessible.”, because there are things that should be more semantic in html than css, js.
  • The specific case or proof of this that I’m talking about here is image alignment that could be done in html, but it’s done in css or js or a mix between inline-css and the div element as I’ll talk about later.
  • In general, I see in recent years a move away from html web developers, many developers are using in most cases css frameworks, js that care so little about the semantics of html.
  • This might be a reason or initial answer I have from my web development experience why the images lined up in css and js and not the html itself.

“note”

I will comment generally on the positive and negative point here and the code examples. image alignment with or without attribute:

“use cases”

image alignment without attribute:

  • To align the image we have to use something like inline in div.
  • But I consider this use case to be ugly and non-semantic.
  • Because from a semantic point of view, images should have an attribute for alignment.
<div style="text-align:center;">
<img src="https://www.files.com/img/img.png"/>
</div>

image alignment with attribute:

  • As we can see, we have an attribute called “type” that can specify the alignment of the image: “center”, “left”, “right”, “aligned”, “justified”.
  • I consider this important, because it allows you to align images through html, and not through css, js.
  • In my general point of view, it’s easier to align images by markup than by style.
  • And from my general point of view it is more semantic to use html than css, js.
<img type="center" src="https://www.files.com/img/img.png"/>

positive point:

  • More semantics around html, and less with css, js.
  • Also there would be no need for frameworks in css, html, js either. Because it would be all semantic within the official html specification.

negative point:

  • My negative point is that everything that is interactive, most developers use css and js. This is bad, because the html is left out. In this sense, the choice to include a new attribute in the html must be very well thought out and planned.
  • So, I hope, in general, I explained why html is important and why we should adopt html markup for aligning images instead of css, js.
  • As I said at the beginning, some might argue that this doesn’t make sense to think about, because it’s possible to align images with div-inline-css or even align images with the inner, outer style. This is a negative point to think about.

“philosophical criticism of technology or technical specification html, css, js” or “questions”:

  • Why do we need css and js for everything?
  • when is html for web developers no longer needed?
  • why can’t we align block images?
  • why do we use frameworks and plugins in jquery, to do something simple in html to align images?
  • why are we using so much css and js and less html?
  • why don’t we have block images with html markup?
  • Is it possible to align images by html than by css, js?
  • why don’t we have a “type” attribute to guide the alignment of images by html?
simevidas
2023-04-02

How?

Anonymous2292900
2023-04-03

Please see this:

<div style="text-align:center;">
<img src="https://www.files.com/img/img.png"/>
</div>

vs

<img align="center" src="https://www.files.com/img/img.png"/>

or

<img type="center" src="https://www.files.com/img/img.png"/>