1

I have been bashing my head against this for a while. I'm a fairly huge novice when it to this so thought it was time to ask for help.

Trying to select all imgs on a page that are set at their default value (unclear if this is auto or initial, because it seems auto is applied by default and the console only shows width with nothing else after) and apply a size to them.

I want this to exclude imgs that I have manually set the size of.

So far I have tried this for my CSS, but it doesn't seem to work.

img:not([width:initial]){
   width: 400px;
}

HTML SECTION OF PAGE WITH IMAGE:

<div class="internal-embed image-embed is-loaded" tabindex="-1"
 src="TeniaeColiHisto.png" alt="TeniaeColiHisto.png" width="" 
height="" contenteditable="false"><img width="" src="app://local
/D%3A%5CSecondBrain%5CImages%5CTeniaeColiHisto.png?1642441174361"
 alt="TeniaeColiHisto.png" height=""></div>

<img width=""
 src="app://local/D%3A%5CSecondBrain%5CImages%5CTeniaeColiHisto.png?1642441174361"
 alt="TeniaeColiHisto.png" height="">

Edit: Made some headway with:

img[width]
{
   width: 400px;
}

It seems I would solve my issue if the following would work but for some reason it doesn't?

img[width]not:([width=""])
{
   width: 400px;
}

EDIT SOLUTION: Turns out the program i'm using doesn't actually automatically set the width of the images. It just inherits them from the source and the actual HTML includes no width or height tag.Thus, the solution was to specify all images that did not these attributes as such.

img:not([width])
{
   width:400px;
}
Davenukem
  • 11
  • 2
  • Is javascript an option? – Wais Kamal Jan 17 '22 at 18:56
  • Trying to do it explicitly on the CSS if possible because the program allows me to easily include custom CSS. – Davenukem Jan 17 '22 at 18:59
  • We need to see the HTML of your page as well in order to assist. Please see [mcve] for more info on that if you have questions. – TylerH Jan 17 '22 at 19:04
  • Does this answer your question? [css selector to match an element without attribute x](https://stackoverflow.com/questions/1533444/css-selector-to-match-an-element-without-attribute-x) – caramba Jan 17 '22 at 20:00
  • Ok,, figured it out!Turns out the program i'm using doesn't actually automatically set the width of the images. It just inherits them from the source and the actual HTML includes no width or height tag.Thus, the solution was to specify all images that did not these attributes as such. `img:not([width]){ width:400px;}` – Davenukem Jan 17 '22 at 21:18

0 Answers0