Page 1 of 1

CSS Round Image

PostPosted: Thu Nov 24, 2022 10:48 pm
by JuanMartin
Hi.

I use this CSS code to round an image in NG Client:

width:40px;
height:50px;
border-radius:25px;

In 2019.6.2 Servoy version works fine, but with 2022.9.0 Servoy version dosen´t works

Any idea

Thanks

Re: CSS Round Image

PostPosted: Fri Nov 25, 2022 9:43 am
by mboegem
Hi,

Most likely it's a difference in the DOM structure between 2019.6.2 and 2022.9.0
Apart from moving upgrading to 2022.9.0 did you also move from NG to TiNG?

In order to help you out, you will need to provide more information:
1) what type of client do you use (NG/TiNG)
2) what type of webcomponent do you use to display the image
3) how do you reference the image
4) what does your style class look like and how is it referenced on the component

Re: CSS Round Image

PostPosted: Fri Nov 25, 2022 10:07 am
by JuanMartin
I'm using NG cliente
I'm using a Image webComponent
The reference to the image is by dataProvider
The reference to the style is by StyleClass
Captura.JPG
Captura.JPG (45.94 KiB) Viewed 3780 times

Re: CSS Round Image

PostPosted: Tue Feb 21, 2023 9:55 pm
by JuanMartin
Any solution for this problem???

In developer the iamge show rounded

[img]developer.jpg[/img]


but wen run the solution, the image looks square

[img]cuadrada.jpg[/img]

Re: CSS Round Image

PostPosted: Tue Feb 28, 2023 6:12 pm
by ProRM
Hola Juan Antonio!

I see you are using pixels in your border-radius. Shouldn´t you use percentage to do it like 50%? (border-radius: 50%;)

Saludos,

Re: CSS Round Image

PostPosted: Wed Mar 01, 2023 2:03 pm
by JuanMartin
Hola Juan

I have also tried it with percentages and it doesn't work

In previous versions, when you associated a style to an image component, it was assigned to you correctly

This is not the case now, when assigning a style to an image component, the box that contains the image does apply the stylo that you are assigning to it, but the image that contains the box does not.

The "bts-media" style is always applied to the image, so for your photo to apply the changes you want in your css, you must create this "bts-media" style in your css and apply the changes there.

I don't know if there should be another property in the image component that would allow this style to be modified, since when making this modification of the "bts-media" this change is applied to all the images of the application and it is not what is desired

Un saludo

Re: CSS Round Image

PostPosted: Wed Mar 01, 2023 4:39 pm
by dcamargo
Hi Juan,

The "bts-media" style is always applied to the image, so for your photo to apply the changes you want in your css, you must create this "bts-media" style in your css and apply the changes there.

I don't know if there should be another property in the image component that would allow this style to be modified, since when making this modification of the "bts-media" this change is applied to all the images of the application and it is not what is desired


You can always limit the scope of the style in CSS by doing something like this:
Code: Select all
/* Using img instead of .bts-media works for both bootstrap component and default Servoy core component */
.your-class-with-round-border > img {
    border-radius: 50%;
}


The round border will be applied only to the components with your custom class

Re: CSS Round Image

PostPosted: Fri Mar 10, 2023 8:03 pm
by JuanMartin
Thanks dcamargo,

That's works fine