2 replies [Last post]
Dels
Dels's picture
Offline
newbie
Last seen: 25 weeks 5 days ago
Joined: 2020-02-03
Posts: 1
Points: 4

Hi, I have grouped the CSS below into 2 versions. Is one of these a preferred structure? Is one better than the other?

Thanks for any thoughts,

Del

Version 1

.pagetext, .galleryheading, .gallery-text, #sitelogo { margin-top: 10px;}
.pagetext, .gallerybox, .galleryheading, .gallery-text { padding: 10px; }
.gallerybox { margin-top: 5px; }
#sitelogo { padding: 5px; }

Version 2

.pagetext, .galleryheading, .gallery-text { margin-top: 10px; padding: 10px;}
.gallerybox { margin-top: 5px; padding: 10px; }
#sitelogo { margin-top: 10px; padding: 5px; }

JohnGT
JohnGT's picture
Offline
newbie
Last seen: 19 weeks 5 days ago
Timezone: GMT-4
Joined: 2020-03-14
Posts: 2
Points: 3

Good question. I wonder also

Good question. I wonder also if one is better than the other.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 19 hours 46 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9761
Points: 3843

Neither qualify as good

#2 is less bad. Both indicate a lack of understanding of the cascade. I'm guessing that you're using something like Bootstrap, which is throwing so much caca at the wall that some is bound to stick.

Keep in mind that CSS doesn't mean much without your showing the html it applies to.

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.