How to optimize CSS for best designing the website structure?

We want to avoid this as much as possible so we’re going to add this to our css instead or just remove it all together so i just erase the width and the height of your loop i’m going to delete those and so the image tag should really have two attributes that you have the source and the alternative text so now let’s go to let’s go back to google and let’s find an image source or if you already have an image um be patient while i find one so i’m just gonna pull it up does anyone have a favorite animal flying there anything rabbit rabbit okay very specific.

I’m going to look up an image on the internet um ideally that’s the shape of a square and then use it for my website so let’s see this one if you want to use an image from the internet all you have to do is find the desired image of your choice i’ll choose this one slightly creepy but that’s okay um i’m going to right click on the image and then press the option that says copy link address and so if i paste this on the nav bar on the search bar and uh that link should just return the image by itself or in this case just entire that’s it okay.

So let’s go back to glitch and in the source attribute in the double quotes i’m going to paste that link and now on our webpage we should see the image or not okay looks like this link didn’t work this happened oh i know why yeah thank you very much jake uh let’s go back and get the image address copy image address there we go so now if we go back to glitch we can delete the link that we previously pasted and now put the original one awesome so now if we go into a new window because the image is a little bit large we can see medusa’s name we can see the handle and then we see our image awesome we can make this a little user friendly right.

So it doesn’t quite look like our design where we have these really nice um viewable images instead we have this funny bombarding the webpage so let’s change this with css okay so let’s go to our style.css file and let’s work on a new line so i just typed enter to go on line 13. and to style a specific image i’m going to put the name of the tag in our case it was img and you can find the name of the tag that’s next to the opening partner so in our case it’s ing so i’m going to type ing and then open a pair of parentheses and remember how i told you that we want to specify the width and the height and css instead of in uh in the html this is why um so let’s go ahead and type width and then let’s do 200 pixels and then do a semicolon.

So we can see that just by modifying the width we can already see that the image is much much smaller which is great but just to make sure that for every single image we add that they reduce back to an even square i’m going to add height and then do 200 pixels and there we go so now if we go back to our web page we can see that the image is there awesome um so if you’re following along on glitch or if you are not um i’m going to share the link to this project because glitch is really really cool because similar to sigma.

A lot of people can work on the same project at the same time or you can go to a project and remix it so that it immediately clones my project to your own web your own profile on glitch so let me share this project with you on the chat is there a way to crop the image instead of stretching it yes so uh with css there are different properties uh so with css instead of using width or height we would use different properties and the way to figure out which properties that you want to use um you would go to google again to look for those properties.

so let’s go ahead and just google and then just put css image properties and then this way we can see what are the different options we have to modify and style our image instead of just stretching it so we can see that we can make the border radius smaller or larger so we can change the styling of our image from square to round we can make it as a thumbnail we can make it responsive we can center it we can do so many different types of things um and you would do this with different properties so look you can see that this one has a padding property this one has opacity there are several several several types of properties and so looking through these types of pages on w3 schools will be really really helpful for your um customization css so we have about four images on our webpage let’s go ahead and just copy this bunny image or whatever image that you have on your website and let’s copy it three more times so we can have um those four images so now it looks pretty similar to our um design which is great now this is the part of the session where i want to introduce a challenge so let’s say that phase two of our of our web app is to make it is to make our images into a grid similar to instagram so let’s see what instagram profiles look like so i’ll put instagram and go to dsc utrgv so let’s see what instagram looks like.

Leave a Comment