The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V < 1 2  
Reply to this topicStart new topic
> Need Help with Syntax Errors, Syntax Errors
spinlady
post Oct 16 2018, 01:32 PM
Post #21





Group: Members
Posts: 5
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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 16 2018, 03:34 PM
Post #22


.
********

Group: WDG Moderators
Posts: 7,919
Joined: 10-August 06
Member No.: 7



QUOTE(spinlady @ Oct 16 2018, 08:32 PM) *

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.
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V < 1 2
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th October 2018 - 09:00 AM