The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Header image affected by image gallery css
nootkan
post Dec 8 2021, 04:17 PM
Post #1


Member
***

Group: Members
Posts: 34
Joined: 16-July 21
Member No.: 28,016



Hi everyone, I need another set of eyes to help me figure out what is affecting my header image size. If I remove the width and height properties the image shows like it should but then doesn't pass the cls score in googles page speed test. When I add the width and height properties the image gets stretched somehow. I thought it had something to do with the image gallery css conflicting with the header img css but nothing I try seems to make a difference. If anyone can see what wrong please advise.

Thanks.

https://www.bassonhook.com/braggn/Braggn.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
nootkan
post Dec 13 2021, 03:25 PM
Post #2


Member
***

Group: Members
Posts: 34
Joined: 16-July 21
Member No.: 28,016



Hi Pandy, I had originally removed those instances of css but it makes the image look unprofessional because it won't center when viewed at a reduced resolution on smart phones.

The exact same css set up exists for the main pages without issues which is why I wanted to see what was causing it on my braggn/braggn.html and about.html pages.

I have removed the img css and related media queries until I can find another way to achieve what I want.

Thanks for all your help and direction.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 13 2021, 04:49 PM
Post #3


.
********

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



QUOTE(nootkan @ Dec 13 2021, 09:25 PM) *

Hi Pandy, I had originally removed those instances of css but it makes the image look unprofessional because it won't center when viewed at a reduced resolution on smart phones.

How about using margin instead of padding for the centering? Margin shouldn't affect the box model regardless of box-sizing value. Or you could remove the extra box-sizing rule below.

QUOTE
The exact same css set up exists for the main pages without issues which is why I wanted to see what was causing it on my braggn/braggn.html and about.html pages.

No, https://www.bassonhook.com/braggn/css/bassonhook.css contains both

CODE
body {
    box-sizing: border-box;
}

and

CODE
* {
    box-sizing: border-box;
}

while https://www.bassonhook.com/css/bassonhook.css only contains

CODE
body {
    box-sizing: border-box;
}

The "box-sizing" property is not inherited, so the styling on the BODY element shouldn't affect the IMG element. See also https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
nootkan
post Dec 15 2021, 04:00 PM
Post #4


Member
***

Group: Members
Posts: 34
Joined: 16-July 21
Member No.: 28,016



QUOTE(Christian J @ Dec 13 2021, 01:49 PM) *

QUOTE(nootkan @ Dec 13 2021, 09:25 PM) *

Hi Pandy, I had originally removed those instances of css but it makes the image look unprofessional because it won't center when viewed at a reduced resolution on smart phones.

How about using margin instead of padding for the centering? Margin shouldn't affect the box model regardless of box-sizing value. Or you could remove the extra box-sizing rule below.

QUOTE
The exact same css set up exists for the main pages without issues which is why I wanted to see what was causing it on my braggn/braggn.html and about.html pages.

No, https://www.bassonhook.com/braggn/css/bassonhook.css contains both

CODE
body {
    box-sizing: border-box;
}

and

CODE
* {
    box-sizing: border-box;
}

while https://www.bassonhook.com/css/bassonhook.css only contains

CODE
body {
    box-sizing: border-box;
}

The "box-sizing" property is not inherited, so the styling on the BODY element shouldn't affect the IMG element. See also https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing


Christian, thanks for this. It turned out to be the padding for the about.html page and a combination of the border-sizing:border-box and padding for the braggn.html page. I removed the box sizing css from the body tag as it was required in the second instance for the gallery. Once I changed the padding to margin in both pages all is good again.

Much appreciated.

This thread is now resolved!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


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

 



- Lo-Fi Version Time is now: 27th April 2024 - 08:10 AM