PSD to HTML 4.4) Styling the Responsive Menu
Transcription of PSD to HTML 4.4) Styling the Responsive Menu
hello and welcome back to the PSD to HTML responsive
portfolio billed as weresizer
browser once we get to that 640 pixel breakpoint our portfolio section breaks
up a little bit and it breaks up into separate lines instead of having it in
four columns all since we’ve already got a media queries set up at break point
let’s go ahead and take care of our menu at that point as well we know from
our Photoshop file that once we get down to a smaller size we want this menu icon
here and then menu icon is going to take the place of the menu itself so first
we actually need to create this menu icon so in our Photoshop file on going
to option right click on that item to select one of the layers in that group
and it’s actually a bunch of layers together if we just turn that off it’s
just one of those bars there and so we actually need all three of these bars as
well as this right here so menu icon in the three rounded rectangles on top of
it goin drugs down to a new group and we’ll just call it menu
icon and then let’s just turn everything else off except that menu icon
by option clicking on the icon next to it or alt clicking if you’re using a PC
and then we’ll go to image trim trim be some transparent pixels click on OK terms
it down and we still it’s got rounded corners so there’s a little bit of
transparency around the edges so we do need to save it as a PNG file will go to
File Save for Web will choose PNG 24 make sure transparency is checked click on
Save and then I’m gonna navigate to the site 22 folder which is where moved everything
and will sit in the images folder there and we’ll call it menu
icon that P&G who saved that let’s now go to File revert for that particular
Photoshop file to go back to our original version and then let’s go into
our code and make something happen here so
in our HTML the very top we have our navigation section here now I’m gonna add
one thing to this navigation section inside our container but just before Arnav
list I’m gonna create an image and I’m gonna give any class of menu icon and
we’re gonna put that menu icon here so the source for that image is going to be
an expander images folder here in case we forget the name of it the source is
going to be images forward slash menu hyphen icon dock P&G and then we
can put an
alt attribute here that says click to expand menu and we go so we can say that and
go back to krone and refresh the page and that basically just pushes everything
down not exactly what we’re going for so what I want to do by the fault
win the browsers and its full size is a win a set that menu icons display so
we’ll come over here to our CSS and then will scroll back all the way up to our
marine navigation section and up here at the very top maybe just below the
neverland itself will point to that menu hyphen icon class which is the class
name we give to that image and will send its display tonight so that the
browser will just pretend like it’s not even there then once we reach that 640
pixel break point I wanted to show up again and I want the menu itself to disappear
so that’s gonna take a little bit of CSS trickery to make that happens we’ll
go back into our CSS files scroll down to the bottom and here’s a responsive
section we’re gonna jump down to the 640 media query and just inside that
640 media query we’re going to create a rule for the in now list
class which is the unordered list that contains our navigation items and I basically
wanted to disappear before we make it disappear I want to apply some different
styles to it first of all I’m gonna give it a different background color
because this is basically gonna be a drop down menu so we’re going to set the
background color to a darker gray than me main navigation menu bar gonna set
the width of that and have less to 100% so that it stretches out all the way
will add some padding maybe 10 pixels of padding inside that drop down list
and let’s see how it looks so far we’ll save that Jim back into our browser
and refresh your page since we’re already below six hundred and forty
and you know it kind of gets us where we’re going but not quite whenever
this appears whenever it expands out I wanted to show up below the
main menu and then I want that menu icon to reappear at this point so let’s come
back to that 640 media query and let’s point to that menu icon icon class and
let’s say its display to block and we need to make sure we spell that right save
it refresh your page and our menu icon is back now we just need to move it down
a little bit so it’s not really begins the top edge of the browser so far
that menu icon will also add maybe a little bit of padding to the top so pending
top let’s do six pixels there and then I want to make sure that when we
hope ur over that image it’s not inside an anchor tag it’s just an image but
when we hover over it I wanna see the pointer cursor so that we knew that we
can click on its oil change your cursor here to pointer so let’s save that
and refresh your page and that mentions it down a little bit now when we
were over it looks like a link so that’s good and
now there’s six pixels in between the bottom of that and the bottom of the original
navigation background so I want to know this drop-down section down another
six pixels so
what we’re gonna do is we’ll come down to that now lists were gonna sit its
margin top property to six pixels save that and refresh and that notice it down
a little bit closer to where we want to be next I
want to nudge it to the left 10 pixels cause we have this 10 pixels of padding over
here and I don’t want that 10 pixels of padding to apply to the struck down
list so I’m gonna give this basically a negative position and we were
gonna do that is we’re going to set the nav list position property to relatives
so that we can get over and we’re simply going to set the left property
to negative 10 pixels and mental midget over 10 pixels to the left save
that and refresh and there we go next thing I want is for these lists items
to be stacked on top of each other because once we get down to a certain size
does not gonna be there might not be enough room for the entire menu especially
if we had more menu items at some point so once we get down to that smaller
size let’s create another rule for Mavs list space allies of the list items
inside a navigation and those are currently loading so let’s go ahead and just
set the displayed a block and sent the float 10 million save that and refresh
your page and that aligns them vertically but knowing a little space between
them so it’s also said he margin bottom property of me 20 pixels save that
and refresh there we go now and get a little more room to work with the problem
now is we have a little too much space on the bottoms we might go into the
rule for the nav list and we said the panning 210 pixels we might just set the
padding bottom here pending hyphen bottom 20 save that and refresh and
that gives us a little bit of a better look there then the last thing I want
to do that menu is make it disappear now who styled it we have it looking
like what we wanted to look like when it finally pops open now want to make
it disappear so we’re gonna go into nav list rule and we’re gonna sit its display
to none now we’ve done all that work we’re gonna save that and refresh it
and we can see that all that work is good for nothing because it’s now disappeared
and another problem that we have now is that our social list has been
moved down because this item here is not flooding to the left and and so once
we get down to that break point instead of having these icons flow to the
right let’s just position them absolutely and that will take care of that
so let’s go back to at 6:40 media query and maybe after are now have lists will
create another rule for our social list which is the unordered list that contains
those social media icons were gonna say its position to absolute will set
the top position 20
pixels Indy right position to 10 pixels will be 10 pixels from the right edge
will see that refresher page and now our social media icons are back where
they originally were so they’re not really changing visually once we get that
break point but the way they’re positioned is changing behind the scenes so
that takes care of some of our issues now we still have the issue of being able
to open and close their menu but we’ll get to that soon for now let’s go ahead
and move on with the next video thank you for watching
PSD to HTML 4.4) Styling the Responsive Menu
Reviewed by Tayyab Saqlain Zakki
on
00:03
Rating:
Reviewed by Tayyab Saqlain Zakki
on
00:03
Rating:

ReplyDeleteA great information you have shared keep it up also try this website download instagram video