PSD to HTML 3.13) Styling the Captions
Previous: PSD to HTML 3.12) Laying Out the Columns
Transcription of PSD to HTML 3.13) Styling the Captions
hello and welcome back to the PSD to HTML responsive portfolio build in thislesson we’re going to finish up our portfolio section by styling options right now it’s just some text up at the top and then the icon below it but if we look in our Photoshop file you can see that we’re gonna adjusted we’re gonna move it down to the bottom and we’re gonna put the semi transparent background behind it were gonna line the text to the left and the icon to the right and so we need to think about how we’re going to make that happen right now if you look in our HTML we can see how it’s put together we have a list item and then inside that list item we have a span with a class of caption inside the span we have an anchor tag that has the text and then our image icon next to it and the text looks like I’m not sure what we did hear you put a closing anchor tag after the text and then another closing anchor tag after the the image not exactly what we were going for so we need to decide which one of those who want to delete and it’s really up to you are up to your client to whoever you’re building the website for whether you want this image to be clickable are not for now I just want the text to be clickable so I’m gonna leave this particular closing Intertek there in a minute get rid of the one after the image so delete those and that should make a little more sense and their ego so again we have inside each list item we have a spam with the class of caption inside that span we have an anchor tag with some text and then we have an image the image has a class of sample icon and again the span has a class of caption so the span class of caption is the container that we’re gonna put that semi transparent black background on and we also need to pull it down to the bottom of the column that its end the bottom of that background image and so we’re going to need to do some fancy positioning here in order to get that to work so what I want to do is I want to use absolute positioning with these span classes here and pull those down to the very bottom of the go ahead and jump back into Photoshop down to the bottom of each of these columns using absolute positioning now in order to do that we need to give the parent item of that span a position of relatives if we don’t give the parent a position of relative and then we give this a position of absolute and set it to 0 then it will pull it all the way down to the bottom of the browser and that’s not what we’re going for we want to pull it down to the bottom of the containing element which means that containing element needs to have a class of position and that’s something you’ll find yourself doing a lot so that’s that’s a particular quarter of CSS thing you need to get used to so again we’re going to jump back into our CSS I moved everything into the site seventeen soldiers all the changes we make in this lesson will be saved there and and let’s jump ahead and make sure our HTML files saved will jump into sight that CSS were still inside the portfolio set section excuse me just jump down here and continue where we left off so first of all as I mentioned we’re gonna give those spans a position of absolute and in order to do that we need to give the apparent item we come back here in the parent item of this span is this list item we need to give this list item with a glass of port laptops we need to give that a position relative and we actually need to give that to all of these lists items not just on with port laptop so we can point to portfolio list space Li and give those allies a a position of relative so will jump back up here here we have portfolio list li and we’ll add it there so just beneath margin rate will add a position here of relative and then we’ll come down to the end of our portfolio items just above the clear fix hack and we’re going to create a rule for portfolio hyphen lists the portfolio list remembers the class applied to the unordered list itself inside the list reporting to the list items inside that were pointing to the spans and remember we’re gonna give these spans a position of absolute once we give it a position of absolute then we can said its bottom coordinate 20 and that will pull it all the way down to the bottom of the parent element that in order for us to look right we also need to set the width and height so we’re going to set our with here to 210 pixels the same width as the container as the list item itself and will give it a height 452 pixels so it’s we also need to give it a background color and I’m gonna use an RGBA value for this background color because again I want to make it semi transparent so the way we’re gonna do that when you said her background color equal to instead of a hex value that starts with a pound sign we’re gonna do RGB a value and it’s going to be black so the first three values which represent our G&B are all gonna be 0 but then our last value represents the Alpha we’re gonna set that 205 let’s see that jump back into our browser here and refresh and it’s a good start we pulled these down to the bottom and we’ve given it a semi transparent background to know when to put a little bit of padding inside that and we can come back to our CSS here and maybe add seven pixels or so of padding save that and refresh and it looks pretty good and then let’s point to the anchor tags within that and edit the text we want to get rid of the underlying and I want to make the text white so we can point to portfolio hyphen lists face a for all the anchor tags inside that portfolio list will set the text color to white and we’ll set text decoration to none and save that refresh your page and there we go now the text looks a lot better and now we need to set the width of the techs because right now but texas to why we wanted to wrap to the left and we want I can to be over here to the right so first one to set the width of it but if we tried to set the width here let’s set it to about a hundred and five pixels we tried to set that save it and refresh its not gonna work because a weaker tagged by the fault is an inline element and he cannot set the width of an inline element so we need to do to fix that is to change the way its display will change its display to block and then that with should work save it refresh there we go now we can set the width of that text field so then I want this these icons here remember they have a class of sample icon I want those to float to the right so we’re going to point to that sample icon class and it’s inside the portfolio list so we wanted to be specific we could say . portfolio list space dot simple life and icon and choose set those to float to the right and it seemed that refresher page and we’re getting a little bit closer you’ll notice that the icon is being nudged down past the height of the text and in order to fix that we just set the text afoot to the less or go back to these anchor tags here and make it flow to the left save that and refresh and their ago now are a lot closer to what we’re looking for however we do have a small problem as you can see this black background is extending out beyond the edge of that two hundred and ten pixel background and that’s because by Defoe remember when you add padding or anything like that to an element it extends the width and height of that element so all we need to do is come back to that list item here and set its order I’m sorry its box sizing property to border hyphen box and that will make sure that this with of 210 pixels will be the final with even after we add padding to it or save it refresh and there we go now we have it back where we want it so that takes care of our portfolio section except one more thing I want to put a little bit of margin above it so that it’s not right up against this text here so we’ll just go back to his portfolio samples rule here and we’ll set some margin top here maybe 10 pixels see how it looks a bit refresh and we’ll go and bring that up to 20 pixels saving refresh again and that looks a lot better now that we’ve got that done we’ll go ahead and move on with him next video thank you for watching
PSD to HTML 3.13) Styling the Captions
Reviewed by Tayyab Saqlain Zakki
on
23:56
Rating:
Reviewed by Tayyab Saqlain Zakki
on
23:56
Rating:

No comments: