The following widgets automatically generate an img HTML tag with height and width attributes.
If you have complex page designs, you may want to remove these attributes to avoid altering them in unexpected ways.
You can do this for the MVC Image and Image gallery widgets. You cannot remove the automatic generation of width and height for the .NET Core Image widget. To do this, you need to modify the widget’s views. Perform the following:
ImageDimensions.cshtml
~/ResourcePackages/Bootstrap4/MVC/Views/Image
.cshtml
@Html.GetWidthAttributeForImage(Model) @Html.GetHeightAttributeForImage(Model)
The width and height attributes are in all templates of the Image Gallery widget. To remove them, delete the helper methods from your template. To do this, perform the following:
width
height
~/ResourcePackages/Bootstrap4/MVC/Views/ImageGallery
@Html.GetWidthAttributeForImage(ViewModel.Width) @Html.GetHeightAttributeForImage(ViewModel.Height)
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important