Curso Básico de CSS - 14. Layout, estructura Basica — Transcript
Full transcript
- 0:08Hello, how are you, friends? Welcome to
- 0:10our next chapter of the basic CSS
- 0:12course. My name is Carlos Arturo and
- 0:14well, this is going to be the last
- 0:16regular chapter of our course. We are
- 0:18going to be learning how to create this
- 0:20basic structure with the things we have
- 0:22learned. We are going to use most of
- 0:23the properties that we have seen. Well,
- 0:26maybe not all of them, but a large part
- 0:28. So, let's start learning how to
- 0:31create this. Now that I have my
- 0:34documents, you know, the HTML document
- 0:36with the basic tags and my CSS
- 0:38stylesheet already linked. It is very
- 0:42easy to do. It may take some practice
- 0:44for you to get used to how to write the
- 0:47tags, to learn what order they go in
- 0:49and things like that. But it is very
- 0:52simple. So, let's get started. First of
- 0:54all, we have to base ourselves on the
- 0:57concept that a website is based on
- 0:59three areas: the header section, the
- 1:01main section (which are the articles
- 1:03together with the sidebar or main
- 1:05section, it is also known) and the
- 1:07footer or footer. So, there are these
- 1:09three parts and for that we are going
- 1:11to start by defining them. We have the
- 1:14header section, we have the main
- 1:16section, which, well, since there is no
- 1:19tag called main or it is not
- 1:20implemented yet, we have to write a
- 1:23section that has the class main and we
- 1:25also have to write our footer section.
- 1:28These three are the sections of our
- 1:30website and inside we are going to
- 1:33write what we need. First of all, in
- 1:35the header, what do we want to have? We
- 1:37want to have both the logo and the menu
- 1:38. For them we write a div. Remember
- 1:41that DIPs are used for images or
- 1:43graphics and within this DI we can even
- 1:46put the class called logo. This is in
- 1:50case we want to work on it later, in
- 1:51this case we are not going to use it.
- 1:53Then we add the image, which in this
- 1:56case is diagonal images logo.jpg. This
- 2:00is because I have my folder here.
- 2:01Inside images I have logo.jpg. Then we
- 2:08add a WID of 100 pixels. There it is.
- 2:12Just to give it an approximate size.
- 2:15And that's it. We have our logo section
- 2:17. Then, inside Header, what do we have?
- 2:20We have our NAV. With the NAF tag we
- 2:22enclose our navigation menu and tell
- 2:24browsers and search engines that this
- 2:26is the part of our site navigation. But
- 2:29this is not our menu yet. Remember that
- 2:32our menu consists of lists and each
- 2:33list, well, already consists of several
- 2:35elements. In this case they are li
- 2:38elements with an a element. In this
- 2:42case, I add them quickly. I have added
- 2:48a basic menu, very simple, really, and
- 2:51we would already have our structure.
- 2:53What I'm going to do is open the
- 2:55document again. If I restart it, if I
- 2:59update my site, the styles will be
- 3:01deleted. So, I want to have them to
- 3:04show you. Here it is. This is the basic
- 3:06structure that we have. We already have
- 3:08both the logo and our menu. And now we
- 3:10are going to work on the articles
- 3:12section and our sidebar. For the
- 3:15articles section, we are going to go to
- 3:17our main section and inside it we are
- 3:19going to tell it that we want another
- 3:21section to store our articles. So we
- 3:24write another section and we put
- 3:25articles in it. In this case, it is
- 3:28plural and inside articles we are going
- 3:30to write our articles. But what other
- 3:32section are we going to have? Well,
- 3:34inside main we are also going to put
- 3:37our aside or our sidebar. So, inside
- 3:41this articles section we are going to
- 3:43start by writing article because we
- 3:44want to use this tag to tell the
- 3:46browser, the web search engine that
- 3:48this is our main content that we want
- 3:50the user to see. It is the most
- 3:52important part of the site. So we are
- 3:55going to add an H2 tag. As you know, we
- 3:57cannot repeat the H1 and since we are
- 3:59going to have several articles, it is
- 4:01important to use H2. We are going to
- 4:04put this as the title of my website.
- 4:09Then we are going to add some filler
- 4:11content just to simulate that we have
- 4:13some text. And there it is. We have our
- 4:15article. I am going to copy it. I'm
- 4:17going to have it twice. You can have it
- 4:19as many times as you want. And we're
- 4:20going to get this simple result. There
- 4:23it is. This is what we have here. Uh,
- 4:26we already have the articles section
- 4:27and now we're going to work on the
- 4:29aside section. I'm simply going to add
- 4:31an H3 to the side and I'm going to put
- 4:34this as my sidebar. There it is. I'm
- 4:37also going to add filler content. You
- 4:39can add anything else. I'll add it and
- 4:41there it is. Let's update. We already
- 4:44have this. So, in the structure we
- 4:46already have the logo, our navigation
- 4:50menu, our articles, and our sidebar.
- 4:53Finally, we need the footer. For this,
- 4:55we go here to our footer tag. And here
- 4:59we write a P tag because I'm going to
- 5:02add some text here that I simply have
- 5:06to put a kind of author. Here, well, I
- 5:10updated it, it's already deleted, but
- 5:11it doesn't matter. Here we have our
- 5:14website. Uh, good, this is done. What
- 5:17are we going to do now? Let's start
- 5:19styling each of our elements and start
- 5:22structuring our website. Let's go to
- 5:25our CSS stylesheet. How do we start?
- 5:31Let's start by adding a universal
- 5:34selector and telling it that all
- 5:37elements will have zero margins and
- 5:39zero padding. Zero and zero are
- 5:42important. What that does is erase all
- 5:44the margins that the browser adds by
- 5:47default and give us a design from
- 5:49scratch that we want. There it is. Next
- 5:52, we're going to work on the body.
- 5:55We're going to add a background to the
- 5:57body. This background that we're going
- 5:59to add is going to be an E6 color. E6.
- 6:01E6 is the only thing we're going to do
- 6:03to the body. Remember that you can
- 6:05change the font here in the body, and
- 6:07you can change the size. By default,
- 6:09I'll add 16 pixels, but it's better to
- 6:12adjust it if you need to. Okay, let's
- 6:15continue. What do we want? We already
- 6:18have this site. Okay, now let's make
- 6:21our site a specific size and center all
- 6:25the content. To do this, what I'm going
- 6:27to do is start with the header. I'm
- 6:29going to show it to you and change its
- 6:32color to a color that looks white to me
- 6:35. Yes, white looks good to me. And
- 6:38let's tell it the following. You're
- 6:40going to have a width of 90%. Here,
- 6:44instead of 90, you could put 1000
- 6:47pixels. I'm going to put 90%for the
- 6:50following. If you put 1000 pixels, if
- 6:52the user's screen is smaller than 1000
- 6:54pixels, they're going to have a problem
- 6:56. So, with 90%, if you have a smaller
- 6:59screen, the content is going to adapt
- 7:01to the percentage of the screen. This
- 7:04is already used for what is known as
- 7:07responsive design or adaptive design.
- 7:10Adaptive design is what you create so
- 7:12that a design adapts to the mobile
- 7:15device that's being viewed. If the
- 7:18design is being viewed on an iPad, well
- 7:19, it has to have certain changes. If
- 7:20you're looking at it on a smartphone,
- 7:22it has more changes. I have a video and
- 7:24a tutorial on my website where you can
- 7:26see about this and how to make
- 7:28responsive designs for mobile devices.
- 7:30But hey, we're not going to go into
- 7:33this any further, we're simply going to
- 7:35set a width of 90%and set a margin of
- 7:37auto. This will center the content. If
- 7:41we update, there it is. As you can see,
- 7:43we have a white background and some
- 7:45margins on the sides. Why is that?
- 7:47Because this blank content is 90%of the
- 7:50size of my screen. But hey, it's too
- 7:53much, I don't want it to be 90%. So,
- 7:55what we're going to do is apply a
- 7:57property called Max Width and tell it
- 7:59that the maximum size it's going to
- 8:01have is 1000 pixels. So we update and
- 8:04the sign gets a little smaller, but now
- 8:06it's 1000 pixels. We're going to apply
- 8:09this to both this content that we have
- 8:11here and to the footer. So, we simply
- 8:13go to the header and tell it to also
- 8:16apply the section and footer items.
- 8:19It's not to the section item, I made a
- 8:21mistake here, it's to the main. There
- 8:25it is, main and footer. Now, let's
- 8:28update and we have this. It's that
- 8:32simple. Here in the Wiid, I've set the
- 8:35margin to auto, but I'm going to tell
- 8:37it to be 20 pixels above and below and
- 8:39auto so that it fits in. Let's update
- 8:42and there it is. We have a margin on
- 8:44each of the elements. That's it for
- 8:46this part. Let's continue now with our
- 8:49navigation menu. For that, let's go to
- 8:52header, then we'll go to navf and then
- 8:55we'll modify our elements. First of all
- 8:57, we're going to grab a background of
- 8:59the following color. I already have the
- 9:02color here, it's 52 8 F D5. We paste it
- 9:07and there it is. We have this color,
- 9:09this white color that we had put here,
- 9:11I'm going to remove it. I don't care
- 9:12about it anymore. And there we are.
- 9:15Let's now put the header naf ul and
- 9:19let's work on the ul. We're simply
- 9:23going to make it have a list style, no.
- 9:27With this, we're going to remove the
- 9:28dots that we have here. So here we
- 9:30update, we remove the dots and, well,
- 9:33we also remove the white background
- 9:35that I mentioned. There we are. Now
- 9:39we're going to make these elements be
- 9:41placed next to each other. For that,
- 9:43we're going to use the float property
- 9:45and its value left so that they all
- 9:48stack to the left. So we're going to go
- 9:51back to header naf ulli and tell it to
- 9:55have a float left property. This is
- 9:58going to make them all stack to the
- 10:00left. This way there's going to be a
- 10:03problem, but we'll fix it right now.
- 10:05There it is. They all stack to the left
- 10:07and the problem we have is that our
- 10:09background disappears. Uh, this
- 10:12disappears. And well, in fact, here we
- 10:14also have the problem with this space
- 10:15that we have here. What happens is that
- 10:17by putting it to the left, the other
- 10:19elements are also affected and the
- 10:21previous ones too. So, here I'm going
- 10:24to use a plugin that I have for Firefox
- 10:26. The plugin is called Firebook. You
- 10:29can download it for Firefox or even by
- 10:32default, just right-click on it,
- 10:34inspect element and you can see it. It
- 10:36works the same with Chrome, Google
- 10:39Chrome also works. So, you do this, you
- 10:42inspect the element and here you will
- 10:45have the following. You can see the
- 10:47elements. If you hover the mouse over
- 10:49body, it will select the entire
- 10:51document. If you hover the mouse over
- 10:53header, it will select the header part
- 10:55and so on for each of the elements. If
- 10:58for some reason it is not colored on
- 11:00the screen, it means that you have
- 11:01something wrong, right? And not
- 11:03visually, but behind in the structure,
- 11:05through the floats and well, all that.
- 11:08So, inside G we have the logo and we
- 11:10have the menu. As you can see, I am
- 11:13clicking on it and it is not coloring
- 11:15anything on the screen. So, why is this
- 11:18? Because we have applied flowat left
- 11:21to the LI, what happens is that NAF,
- 11:23since it does not have a flowat left,
- 11:25also gets ruined. The ideal solution,
- 11:27as you might say, would be to add a
- 11:29flow left here, but the problem is that
- 11:31if we add a flow left, we would also
- 11:33have to add it to the others. The
- 11:35simplest solution is to add an overflow
- 11:37hiden property. With overflow hiden, we
- 11:41solve this problem that we have and if
- 11:43we update, we will now have our menu.
- 11:46Overflow hiden serves two purposes: one
- 11:50is to hide the content that exceeds our
- 11:55container. That is, if we have very
- 11:57large content and our container does
- 11:58not end, with overflow hiden we make it
- 12:00disappear. This is one of its functions
- 12:03, but the other is, let's say, to clean
- 12:07our flow at left. If we have a flow at
- 12:10left and a flow at container, we clean
- 12:12it with this. So, Overflow hiden is
- 12:15also a very good property, and well, it
- 12:17is simply a matter of practicing with
- 12:20it. Let's now work with the A elements
- 12:23inside the LI. That's right, to modify
- 12:27the links. As we saw in previous
- 12:29chapters, I showed you how to make a
- 12:31navigation menu, so we're going to do
- 12:33exactly the same thing. All we're going
- 12:35to do is give it a padding of 10 pixels
- 12:37and 20 on both sides. And we're going
- 12:40to put a display block on it. With
- 12:44display block we can allow it to have
- 12:46padding up and down. If we don't put
- 12:49display block on it, this padding won't
- 12:51work, it only works to the sides. We
- 12:53have this. We're also going to change
- 12:56the color to white and we're also going
- 12:58to put a text decoration, text
- 13:00decoration known as text decoration to
- 13:03remove the ugly underline. We update
- 13:06and now we have our navigation menu.
- 13:09Finally, if you want, you can add a
- 13:11hover and change the background. In
- 13:18this case I already have one that I
- 13:19copied, I'm simply going to paste it.
- 13:22Here we update and there it is. We
- 13:24change the color and it works. And here
- 13:26we go with the header part. Now we're
- 13:29going to move on to the main part. For
- 13:32main it's also very simple, but you
- 13:34have to keep a few things in mind.
- 13:37Let's start by writing main articles,
- 13:40which is good because it's our class.
- 13:43It's the class that contains all our
- 13:45articles. And what we're going to tell
- 13:47it is the following. You're going to
- 13:48have a Wi, we're also going to set it
- 13:50to a percentage of 70%. Uh, you're
- 13:54going to have a float left. With this,
- 13:57with fluat left we make the container
- 13:59go to the left. Remember that. And
- 14:02there it is. Let's update. And if you
- 14:04notice, we already have two columns.
- 14:07For now I'm going to give it a white
- 14:09background. There it is. Let's update
- 14:13and I have a white background. Now you
- 14:15can tell. We have both the part for our
- 14:18articles and the sidebar. And if you
- 14:22notice, this part is 70%of the entire
- 14:24document, the size of our parent
- 14:27element. And this sidebar, well, this
- 14:30is the calculation that the browser
- 14:32makes by default, is the remaining size
- 14:35, but we also have to specify it. So
- 14:37let's specify it so we're going to tell
- 14:40it aside and we're going to tell it
- 14:42that in aside we're going to have a
- 14:45width of 30%so that 70 and 30 gives us
- 14:47100%. We're going to put a background
- 14:49on it. And of course we're going to put
- 14:52the ugliest background in the entire
- 14:54history of the entire world. There it
- 14:56is. Let's update it. And we have this,
- 15:00we have the orange background. But what
- 15:03happens is that by giving it a special
- 15:05measurement of 30%we're putting it down
- 15:07. If we want to put it back here, to
- 15:11the left, we have to put our float left
- 15:15again, our float left. And in this way
- 15:19we have the floatlet to the left in the
- 15:21articles and in the aside. With the
- 15:24floatlet we are putting the columns.
- 15:26There it is. We already have the two
- 15:28columns. Let's do some more advanced
- 15:30things, like for example adding a
- 15:32margin. Let's add a margin. Let's go
- 15:36here to articles and we're going to add
- 15:39a margin, margin right of 1.5%. But if
- 15:44we add it, it wouldn't be 100%.
- 15:47Therefore, here we have to change it
- 15:49from 70 to 68.5%so that the total is
- 15:52100. And there it is. Now, if we update
- 15:55, there would be no problem. We have
- 15:57the margin and this box gets a little
- 15:59smaller and we already have our margin.
- 16:02And this is the way. In this case, I
- 16:04calculated it and that's it. Let's
- 16:07continue now with...we already have
- 16:09both the side, but we're going to add
- 16:11padding to the side. What's more, we're
- 16:13going to work better with the articles
- 16:15and now we're working with the padding
- 16:17of the side. Let's go here to point
- 16:20main point articles and let's say
- 16:22article. All the articles that are
- 16:26going to have...Let's tell them to have
- 16:28a padding of 20 pixels and they're
- 16:30going to have a white background. I'm
- 16:33going to remove this background up here
- 16:34, I'm simply going to leave it down
- 16:36here because they're also going to have
- 16:38a margin and a bottom of 20 pixels.
- 16:42There we are. That's how we're going to
- 16:44leave it. We update and all we do is
- 16:47add an internal margin to each article
- 16:50and we also add an external margin down
- 16:53each article giving this separation.
- 16:56And there we have it. Here we have
- 16:57separated it and if you notice the
- 16:59footer is placed on this side. Eh, we
- 17:01are going to start giving the footer
- 17:03properties, just a few so you can see
- 17:06how it looks. We are going to make the
- 17:10background black and we are going to
- 17:12make the font color white. We update
- 17:14and there it is. We have our footer. If
- 17:17you notice, here we have a problem and
- 17:19it is placed on this side. We are going
- 17:21to fix it. I just wanted to let you
- 17:23know that this problem exists, but
- 17:25first we are going to style the sidebar
- 17:27here that I forgot. In the helper we
- 17:29are going to tell it that it is also
- 17:31going to have a padding of 20 pixels.
- 17:35It is an internal padding. Here we
- 17:37update and there it is. If you notice,
- 17:41the padding has made the container
- 17:43bigger, more than 30%, which is why it
- 17:46moves it down. We do not want that to
- 17:49happen. So, we're going to use the
- 17:52boxizing property, which I mentioned
- 17:54earlier, border box. And with this
- 17:57property, we fix the problem. There it
- 18:00is. You can search for this box sizing
- 18:03property on my website. You simply type
- 18:05boxizing in the search bar and I have a
- 18:07very good article in which I talk about
- 18:09it. There it is. We already have our
- 18:12site and we just need to fix the font.
- 18:14To fix it, we have to apply a property
- 18:17called Clear, which with Clearbot, what
- 18:21we do is clean the float lefts. By
- 18:24default, the floats leave a trace in
- 18:27the elements both before and after this
- 18:31property. So with fl, with Clearbot, we
- 18:34tell it, you're going to clean the
- 18:35float lefts from here and, let's say,
- 18:37you're going to give me a line break
- 18:39somehow, not with a visible spacing,
- 18:41but rather in the structure you're
- 18:43going to have a separation. So, we
- 18:46update and with Clearbot, now we have
- 18:48the separation and with Clearbot, we
- 18:50are now respecting the entire size.
- 18:53Finally, I'm going to add a padding of
- 18:5610 pixels up here and zero pixels on
- 18:58the sides. I'm going to put a text
- 19:01align center to our document and that's
- 19:04how we update it and there we have our
- 19:07finished structure. That's a very basic
- 19:10structure, but it's useful for
- 19:11practicing, for, let's say, creating
- 19:13your first website. Obviously, you can
- 19:16do more advanced things and well,
- 19:18that's what we've been learning with
- 19:20this course, that was the goal to be
- 19:22able to create this structure, to learn
- 19:24more about the properties. This is a
- 19:27CSS course, not a web design course. If
- 19:30you want to advance a little bit more
- 19:32and already understand these properties
- 19:35and know how to use them, you can go to
- 19:37my website for my web design course. In
- 19:40my web design course, you're going to
- 19:42learn how to do a more advanced design.
- 19:45You're not going to see the CSS
- 19:47properties anymore, you're simply going
- 19:49to use them and in the end, the result
- 19:52that we're using with this course is
- 19:54this, a website with a different menu.
- 19:58We have a fully functional slider. It's
- 20:00a different website structure. As you
- 20:03can see, we also have our sidebar, our
- 20:06articles, a different footer. Well, I
- 20:09recommend that you watch this course,
- 20:11it's also quite good, it will help you
- 20:14practice and create your own websites.
- 20:16Well, that's all for this chapter, this
- 20:19last regular chapter of the CSS course.
- 20:22You already know that my name is Carlos
- 20:24Arturo. If you liked the CSS and HTML
- 20:26course, please subscribe, follow me on
- 20:28Twitter, don't forget to visit my
- 20:30website where I'm writing very good
- 20:32articles about web design and I'll see
- 20:34you next time. If you liked the video,
- 20:37please don't forget to subscribe to the
- 20:39channel, as well as follow me on
- 20:41Twitter at @falconmasters. Finally, I
- 20:43invite you to visit my website
- 20:45www.falconmasters.com where you will
- 20:47find tutorials and resources about web
- 20:49development and design. M.
About this transcript
This page contains the full transcript of Curso Básico de CSS - 14. Layout, estructura Basica by FalconMasters, generated from the public captions YouTube serves with the video. The transcript has 3,650 words across 493 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.