Need Help with Syntax Errors, Syntax Errors |
Need Help with Syntax Errors, Syntax Errors |
spinlady |
Oct 16 2018, 01:32 PM
Post
#21
|
Group: Members Posts: 6 Joined: 10-October 18 Member No.: 26,729 |
Okay, I finally got it! I was going about it bass-ackwards. This CSS
img { width: 100%; height: auto; } made all 350 photos 100% of screen size. That was perfect, all except for 5 that I wanted to be actual size. So I was trying to write a class for the 5 that exempted them from the 100% rule. Everything I tried rendered all the photos 100% or all actual size. Your response, CharlesEF, helped me to an epiphany: if I do nothing, all photos will render at actual size. So what I need to do is write a class, img.pixels { width: 100%; height: auto; } that will make the 345 photos 100%. Simple, when you’re not intransigently stuck on thinking that it’s easier to change 5 than 345, when, in reality, BBEdit changes 345, via find and replace, as instantly as it does 5. And still zero syntax errors. So, with final proofing, I’m ready to publish, hopefully not to perish. Many thanks, CharlesEF, Pandy, and ChristianJ for all your help and patience. David |
Christian J |
Oct 16 2018, 03:34 PM
Post
#22
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
So I was trying to write a class for the 5 that exempted them from the 100% rule. Makes sense to me. But there are many ways to approach this, which one to choose may depend on e.g. the HTML structure, if the stylesheet is going to be used for other pages on the site, etc. QUOTE Everything I tried rendered all the photos 100% or all actual size. There must have been a typo of some sort. The styling of a matching CLASS selector should always override the styling for the IMG selector, because CLASS has higher specificity than a simple element. QUOTE Simple, when you’re not intransigently stuck on thinking that it’s easier to change 5 than 345, when, in reality, BBEdit changes 345, via find and replace, as instantly as it does 5. True. The HTML file will be a little larger, but probably not enough to have practical consequences. In general, it usually makes sense to apply the most basic/generic styling to the element selector (e.g., IMG), more specialized styling to CLASS selectors or combinations of element selectors (e.g., H1 IMG) and finally unique styling to ID selectors. Either way should work, though. |
Lo-Fi Version | Time is now: 26th April 2024 - 03:53 AM |