YouTube2Text

Curso Básico de CSS - 14. Layout, estructura Basica — Transcript

by FalconMasters · 3,650 words · 493 segments · language en · Watch on YouTube

Full transcript

  1. 0:08Hello, how are you, friends? Welcome to
  2. 0:10our next chapter of the basic CSS
  3. 0:12course. My name is Carlos Arturo and
  4. 0:14well, this is going to be the last
  5. 0:16regular chapter of our course. We are
  6. 0:18going to be learning how to create this
  7. 0:20basic structure with the things we have
  8. 0:22learned. We are going to use most of
  9. 0:23the properties that we have seen. Well,
  10. 0:26maybe not all of them, but a large part
  11. 0:28. So, let's start learning how to
  12. 0:31create this. Now that I have my
  13. 0:34documents, you know, the HTML document
  14. 0:36with the basic tags and my CSS
  15. 0:38stylesheet already linked. It is very
  16. 0:42easy to do. It may take some practice
  17. 0:44for you to get used to how to write the
  18. 0:47tags, to learn what order they go in
  19. 0:49and things like that. But it is very
  20. 0:52simple. So, let's get started. First of
  21. 0:54all, we have to base ourselves on the
  22. 0:57concept that a website is based on
  23. 0:59three areas: the header section, the
  24. 1:01main section (which are the articles
  25. 1:03together with the sidebar or main
  26. 1:05section, it is also known) and the
  27. 1:07footer or footer. So, there are these
  28. 1:09three parts and for that we are going
  29. 1:11to start by defining them. We have the
  30. 1:14header section, we have the main
  31. 1:16section, which, well, since there is no
  32. 1:19tag called main or it is not
  33. 1:20implemented yet, we have to write a
  34. 1:23section that has the class main and we
  35. 1:25also have to write our footer section.
  36. 1:28These three are the sections of our
  37. 1:30website and inside we are going to
  38. 1:33write what we need. First of all, in
  39. 1:35the header, what do we want to have? We
  40. 1:37want to have both the logo and the menu
  41. 1:38. For them we write a div. Remember
  42. 1:41that DIPs are used for images or
  43. 1:43graphics and within this DI we can even
  44. 1:46put the class called logo. This is in
  45. 1:50case we want to work on it later, in
  46. 1:51this case we are not going to use it.
  47. 1:53Then we add the image, which in this
  48. 1:56case is diagonal images logo.jpg. This
  49. 2:00is because I have my folder here.
  50. 2:01Inside images I have logo.jpg. Then we
  51. 2:08add a WID of 100 pixels. There it is.
  52. 2:12Just to give it an approximate size.
  53. 2:15And that's it. We have our logo section
  54. 2:17. Then, inside Header, what do we have?
  55. 2:20We have our NAV. With the NAF tag we
  56. 2:22enclose our navigation menu and tell
  57. 2:24browsers and search engines that this
  58. 2:26is the part of our site navigation. But
  59. 2:29this is not our menu yet. Remember that
  60. 2:32our menu consists of lists and each
  61. 2:33list, well, already consists of several
  62. 2:35elements. In this case they are li
  63. 2:38elements with an a element. In this
  64. 2:42case, I add them quickly. I have added
  65. 2:48a basic menu, very simple, really, and
  66. 2:51we would already have our structure.
  67. 2:53What I'm going to do is open the
  68. 2:55document again. If I restart it, if I
  69. 2:59update my site, the styles will be
  70. 3:01deleted. So, I want to have them to
  71. 3:04show you. Here it is. This is the basic
  72. 3:06structure that we have. We already have
  73. 3:08both the logo and our menu. And now we
  74. 3:10are going to work on the articles
  75. 3:12section and our sidebar. For the
  76. 3:15articles section, we are going to go to
  77. 3:17our main section and inside it we are
  78. 3:19going to tell it that we want another
  79. 3:21section to store our articles. So we
  80. 3:24write another section and we put
  81. 3:25articles in it. In this case, it is
  82. 3:28plural and inside articles we are going
  83. 3:30to write our articles. But what other
  84. 3:32section are we going to have? Well,
  85. 3:34inside main we are also going to put
  86. 3:37our aside or our sidebar. So, inside
  87. 3:41this articles section we are going to
  88. 3:43start by writing article because we
  89. 3:44want to use this tag to tell the
  90. 3:46browser, the web search engine that
  91. 3:48this is our main content that we want
  92. 3:50the user to see. It is the most
  93. 3:52important part of the site. So we are
  94. 3:55going to add an H2 tag. As you know, we
  95. 3:57cannot repeat the H1 and since we are
  96. 3:59going to have several articles, it is
  97. 4:01important to use H2. We are going to
  98. 4:04put this as the title of my website.
  99. 4:09Then we are going to add some filler
  100. 4:11content just to simulate that we have
  101. 4:13some text. And there it is. We have our
  102. 4:15article. I am going to copy it. I'm
  103. 4:17going to have it twice. You can have it
  104. 4:19as many times as you want. And we're
  105. 4:20going to get this simple result. There
  106. 4:23it is. This is what we have here. Uh,
  107. 4:26we already have the articles section
  108. 4:27and now we're going to work on the
  109. 4:29aside section. I'm simply going to add
  110. 4:31an H3 to the side and I'm going to put
  111. 4:34this as my sidebar. There it is. I'm
  112. 4:37also going to add filler content. You
  113. 4:39can add anything else. I'll add it and
  114. 4:41there it is. Let's update. We already
  115. 4:44have this. So, in the structure we
  116. 4:46already have the logo, our navigation
  117. 4:50menu, our articles, and our sidebar.
  118. 4:53Finally, we need the footer. For this,
  119. 4:55we go here to our footer tag. And here
  120. 4:59we write a P tag because I'm going to
  121. 5:02add some text here that I simply have
  122. 5:06to put a kind of author. Here, well, I
  123. 5:10updated it, it's already deleted, but
  124. 5:11it doesn't matter. Here we have our
  125. 5:14website. Uh, good, this is done. What
  126. 5:17are we going to do now? Let's start
  127. 5:19styling each of our elements and start
  128. 5:22structuring our website. Let's go to
  129. 5:25our CSS stylesheet. How do we start?
  130. 5:31Let's start by adding a universal
  131. 5:34selector and telling it that all
  132. 5:37elements will have zero margins and
  133. 5:39zero padding. Zero and zero are
  134. 5:42important. What that does is erase all
  135. 5:44the margins that the browser adds by
  136. 5:47default and give us a design from
  137. 5:49scratch that we want. There it is. Next
  138. 5:52, we're going to work on the body.
  139. 5:55We're going to add a background to the
  140. 5:57body. This background that we're going
  141. 5:59to add is going to be an E6 color. E6.
  142. 6:01E6 is the only thing we're going to do
  143. 6:03to the body. Remember that you can
  144. 6:05change the font here in the body, and
  145. 6:07you can change the size. By default,
  146. 6:09I'll add 16 pixels, but it's better to
  147. 6:12adjust it if you need to. Okay, let's
  148. 6:15continue. What do we want? We already
  149. 6:18have this site. Okay, now let's make
  150. 6:21our site a specific size and center all
  151. 6:25the content. To do this, what I'm going
  152. 6:27to do is start with the header. I'm
  153. 6:29going to show it to you and change its
  154. 6:32color to a color that looks white to me
  155. 6:35. Yes, white looks good to me. And
  156. 6:38let's tell it the following. You're
  157. 6:40going to have a width of 90%. Here,
  158. 6:44instead of 90, you could put 1000
  159. 6:47pixels. I'm going to put 90%for the
  160. 6:50following. If you put 1000 pixels, if
  161. 6:52the user's screen is smaller than 1000
  162. 6:54pixels, they're going to have a problem
  163. 6:56. So, with 90%, if you have a smaller
  164. 6:59screen, the content is going to adapt
  165. 7:01to the percentage of the screen. This
  166. 7:04is already used for what is known as
  167. 7:07responsive design or adaptive design.
  168. 7:10Adaptive design is what you create so
  169. 7:12that a design adapts to the mobile
  170. 7:15device that's being viewed. If the
  171. 7:18design is being viewed on an iPad, well
  172. 7:19, it has to have certain changes. If
  173. 7:20you're looking at it on a smartphone,
  174. 7:22it has more changes. I have a video and
  175. 7:24a tutorial on my website where you can
  176. 7:26see about this and how to make
  177. 7:28responsive designs for mobile devices.
  178. 7:30But hey, we're not going to go into
  179. 7:33this any further, we're simply going to
  180. 7:35set a width of 90%and set a margin of
  181. 7:37auto. This will center the content. If
  182. 7:41we update, there it is. As you can see,
  183. 7:43we have a white background and some
  184. 7:45margins on the sides. Why is that?
  185. 7:47Because this blank content is 90%of the
  186. 7:50size of my screen. But hey, it's too
  187. 7:53much, I don't want it to be 90%. So,
  188. 7:55what we're going to do is apply a
  189. 7:57property called Max Width and tell it
  190. 7:59that the maximum size it's going to
  191. 8:01have is 1000 pixels. So we update and
  192. 8:04the sign gets a little smaller, but now
  193. 8:06it's 1000 pixels. We're going to apply
  194. 8:09this to both this content that we have
  195. 8:11here and to the footer. So, we simply
  196. 8:13go to the header and tell it to also
  197. 8:16apply the section and footer items.
  198. 8:19It's not to the section item, I made a
  199. 8:21mistake here, it's to the main. There
  200. 8:25it is, main and footer. Now, let's
  201. 8:28update and we have this. It's that
  202. 8:32simple. Here in the Wiid, I've set the
  203. 8:35margin to auto, but I'm going to tell
  204. 8:37it to be 20 pixels above and below and
  205. 8:39auto so that it fits in. Let's update
  206. 8:42and there it is. We have a margin on
  207. 8:44each of the elements. That's it for
  208. 8:46this part. Let's continue now with our
  209. 8:49navigation menu. For that, let's go to
  210. 8:52header, then we'll go to navf and then
  211. 8:55we'll modify our elements. First of all
  212. 8:57, we're going to grab a background of
  213. 8:59the following color. I already have the
  214. 9:02color here, it's 52 8 F D5. We paste it
  215. 9:07and there it is. We have this color,
  216. 9:09this white color that we had put here,
  217. 9:11I'm going to remove it. I don't care
  218. 9:12about it anymore. And there we are.
  219. 9:15Let's now put the header naf ul and
  220. 9:19let's work on the ul. We're simply
  221. 9:23going to make it have a list style, no.
  222. 9:27With this, we're going to remove the
  223. 9:28dots that we have here. So here we
  224. 9:30update, we remove the dots and, well,
  225. 9:33we also remove the white background
  226. 9:35that I mentioned. There we are. Now
  227. 9:39we're going to make these elements be
  228. 9:41placed next to each other. For that,
  229. 9:43we're going to use the float property
  230. 9:45and its value left so that they all
  231. 9:48stack to the left. So we're going to go
  232. 9:51back to header naf ulli and tell it to
  233. 9:55have a float left property. This is
  234. 9:58going to make them all stack to the
  235. 10:00left. This way there's going to be a
  236. 10:03problem, but we'll fix it right now.
  237. 10:05There it is. They all stack to the left
  238. 10:07and the problem we have is that our
  239. 10:09background disappears. Uh, this
  240. 10:12disappears. And well, in fact, here we
  241. 10:14also have the problem with this space
  242. 10:15that we have here. What happens is that
  243. 10:17by putting it to the left, the other
  244. 10:19elements are also affected and the
  245. 10:21previous ones too. So, here I'm going
  246. 10:24to use a plugin that I have for Firefox
  247. 10:26. The plugin is called Firebook. You
  248. 10:29can download it for Firefox or even by
  249. 10:32default, just right-click on it,
  250. 10:34inspect element and you can see it. It
  251. 10:36works the same with Chrome, Google
  252. 10:39Chrome also works. So, you do this, you
  253. 10:42inspect the element and here you will
  254. 10:45have the following. You can see the
  255. 10:47elements. If you hover the mouse over
  256. 10:49body, it will select the entire
  257. 10:51document. If you hover the mouse over
  258. 10:53header, it will select the header part
  259. 10:55and so on for each of the elements. If
  260. 10:58for some reason it is not colored on
  261. 11:00the screen, it means that you have
  262. 11:01something wrong, right? And not
  263. 11:03visually, but behind in the structure,
  264. 11:05through the floats and well, all that.
  265. 11:08So, inside G we have the logo and we
  266. 11:10have the menu. As you can see, I am
  267. 11:13clicking on it and it is not coloring
  268. 11:15anything on the screen. So, why is this
  269. 11:18? Because we have applied flowat left
  270. 11:21to the LI, what happens is that NAF,
  271. 11:23since it does not have a flowat left,
  272. 11:25also gets ruined. The ideal solution,
  273. 11:27as you might say, would be to add a
  274. 11:29flow left here, but the problem is that
  275. 11:31if we add a flow left, we would also
  276. 11:33have to add it to the others. The
  277. 11:35simplest solution is to add an overflow
  278. 11:37hiden property. With overflow hiden, we
  279. 11:41solve this problem that we have and if
  280. 11:43we update, we will now have our menu.
  281. 11:46Overflow hiden serves two purposes: one
  282. 11:50is to hide the content that exceeds our
  283. 11:55container. That is, if we have very
  284. 11:57large content and our container does
  285. 11:58not end, with overflow hiden we make it
  286. 12:00disappear. This is one of its functions
  287. 12:03, but the other is, let's say, to clean
  288. 12:07our flow at left. If we have a flow at
  289. 12:10left and a flow at container, we clean
  290. 12:12it with this. So, Overflow hiden is
  291. 12:15also a very good property, and well, it
  292. 12:17is simply a matter of practicing with
  293. 12:20it. Let's now work with the A elements
  294. 12:23inside the LI. That's right, to modify
  295. 12:27the links. As we saw in previous
  296. 12:29chapters, I showed you how to make a
  297. 12:31navigation menu, so we're going to do
  298. 12:33exactly the same thing. All we're going
  299. 12:35to do is give it a padding of 10 pixels
  300. 12:37and 20 on both sides. And we're going
  301. 12:40to put a display block on it. With
  302. 12:44display block we can allow it to have
  303. 12:46padding up and down. If we don't put
  304. 12:49display block on it, this padding won't
  305. 12:51work, it only works to the sides. We
  306. 12:53have this. We're also going to change
  307. 12:56the color to white and we're also going
  308. 12:58to put a text decoration, text
  309. 13:00decoration known as text decoration to
  310. 13:03remove the ugly underline. We update
  311. 13:06and now we have our navigation menu.
  312. 13:09Finally, if you want, you can add a
  313. 13:11hover and change the background. In
  314. 13:18this case I already have one that I
  315. 13:19copied, I'm simply going to paste it.
  316. 13:22Here we update and there it is. We
  317. 13:24change the color and it works. And here
  318. 13:26we go with the header part. Now we're
  319. 13:29going to move on to the main part. For
  320. 13:32main it's also very simple, but you
  321. 13:34have to keep a few things in mind.
  322. 13:37Let's start by writing main articles,
  323. 13:40which is good because it's our class.
  324. 13:43It's the class that contains all our
  325. 13:45articles. And what we're going to tell
  326. 13:47it is the following. You're going to
  327. 13:48have a Wi, we're also going to set it
  328. 13:50to a percentage of 70%. Uh, you're
  329. 13:54going to have a float left. With this,
  330. 13:57with fluat left we make the container
  331. 13:59go to the left. Remember that. And
  332. 14:02there it is. Let's update. And if you
  333. 14:04notice, we already have two columns.
  334. 14:07For now I'm going to give it a white
  335. 14:09background. There it is. Let's update
  336. 14:13and I have a white background. Now you
  337. 14:15can tell. We have both the part for our
  338. 14:18articles and the sidebar. And if you
  339. 14:22notice, this part is 70%of the entire
  340. 14:24document, the size of our parent
  341. 14:27element. And this sidebar, well, this
  342. 14:30is the calculation that the browser
  343. 14:32makes by default, is the remaining size
  344. 14:35, but we also have to specify it. So
  345. 14:37let's specify it so we're going to tell
  346. 14:40it aside and we're going to tell it
  347. 14:42that in aside we're going to have a
  348. 14:45width of 30%so that 70 and 30 gives us
  349. 14:47100%. We're going to put a background
  350. 14:49on it. And of course we're going to put
  351. 14:52the ugliest background in the entire
  352. 14:54history of the entire world. There it
  353. 14:56is. Let's update it. And we have this,
  354. 15:00we have the orange background. But what
  355. 15:03happens is that by giving it a special
  356. 15:05measurement of 30%we're putting it down
  357. 15:07. If we want to put it back here, to
  358. 15:11the left, we have to put our float left
  359. 15:15again, our float left. And in this way
  360. 15:19we have the floatlet to the left in the
  361. 15:21articles and in the aside. With the
  362. 15:24floatlet we are putting the columns.
  363. 15:26There it is. We already have the two
  364. 15:28columns. Let's do some more advanced
  365. 15:30things, like for example adding a
  366. 15:32margin. Let's add a margin. Let's go
  367. 15:36here to articles and we're going to add
  368. 15:39a margin, margin right of 1.5%. But if
  369. 15:44we add it, it wouldn't be 100%.
  370. 15:47Therefore, here we have to change it
  371. 15:49from 70 to 68.5%so that the total is
  372. 15:52100. And there it is. Now, if we update
  373. 15:55, there would be no problem. We have
  374. 15:57the margin and this box gets a little
  375. 15:59smaller and we already have our margin.
  376. 16:02And this is the way. In this case, I
  377. 16:04calculated it and that's it. Let's
  378. 16:07continue now with...we already have
  379. 16:09both the side, but we're going to add
  380. 16:11padding to the side. What's more, we're
  381. 16:13going to work better with the articles
  382. 16:15and now we're working with the padding
  383. 16:17of the side. Let's go here to point
  384. 16:20main point articles and let's say
  385. 16:22article. All the articles that are
  386. 16:26going to have...Let's tell them to have
  387. 16:28a padding of 20 pixels and they're
  388. 16:30going to have a white background. I'm
  389. 16:33going to remove this background up here
  390. 16:34, I'm simply going to leave it down
  391. 16:36here because they're also going to have
  392. 16:38a margin and a bottom of 20 pixels.
  393. 16:42There we are. That's how we're going to
  394. 16:44leave it. We update and all we do is
  395. 16:47add an internal margin to each article
  396. 16:50and we also add an external margin down
  397. 16:53each article giving this separation.
  398. 16:56And there we have it. Here we have
  399. 16:57separated it and if you notice the
  400. 16:59footer is placed on this side. Eh, we
  401. 17:01are going to start giving the footer
  402. 17:03properties, just a few so you can see
  403. 17:06how it looks. We are going to make the
  404. 17:10background black and we are going to
  405. 17:12make the font color white. We update
  406. 17:14and there it is. We have our footer. If
  407. 17:17you notice, here we have a problem and
  408. 17:19it is placed on this side. We are going
  409. 17:21to fix it. I just wanted to let you
  410. 17:23know that this problem exists, but
  411. 17:25first we are going to style the sidebar
  412. 17:27here that I forgot. In the helper we
  413. 17:29are going to tell it that it is also
  414. 17:31going to have a padding of 20 pixels.
  415. 17:35It is an internal padding. Here we
  416. 17:37update and there it is. If you notice,
  417. 17:41the padding has made the container
  418. 17:43bigger, more than 30%, which is why it
  419. 17:46moves it down. We do not want that to
  420. 17:49happen. So, we're going to use the
  421. 17:52boxizing property, which I mentioned
  422. 17:54earlier, border box. And with this
  423. 17:57property, we fix the problem. There it
  424. 18:00is. You can search for this box sizing
  425. 18:03property on my website. You simply type
  426. 18:05boxizing in the search bar and I have a
  427. 18:07very good article in which I talk about
  428. 18:09it. There it is. We already have our
  429. 18:12site and we just need to fix the font.
  430. 18:14To fix it, we have to apply a property
  431. 18:17called Clear, which with Clearbot, what
  432. 18:21we do is clean the float lefts. By
  433. 18:24default, the floats leave a trace in
  434. 18:27the elements both before and after this
  435. 18:31property. So with fl, with Clearbot, we
  436. 18:34tell it, you're going to clean the
  437. 18:35float lefts from here and, let's say,
  438. 18:37you're going to give me a line break
  439. 18:39somehow, not with a visible spacing,
  440. 18:41but rather in the structure you're
  441. 18:43going to have a separation. So, we
  442. 18:46update and with Clearbot, now we have
  443. 18:48the separation and with Clearbot, we
  444. 18:50are now respecting the entire size.
  445. 18:53Finally, I'm going to add a padding of
  446. 18:5610 pixels up here and zero pixels on
  447. 18:58the sides. I'm going to put a text
  448. 19:01align center to our document and that's
  449. 19:04how we update it and there we have our
  450. 19:07finished structure. That's a very basic
  451. 19:10structure, but it's useful for
  452. 19:11practicing, for, let's say, creating
  453. 19:13your first website. Obviously, you can
  454. 19:16do more advanced things and well,
  455. 19:18that's what we've been learning with
  456. 19:20this course, that was the goal to be
  457. 19:22able to create this structure, to learn
  458. 19:24more about the properties. This is a
  459. 19:27CSS course, not a web design course. If
  460. 19:30you want to advance a little bit more
  461. 19:32and already understand these properties
  462. 19:35and know how to use them, you can go to
  463. 19:37my website for my web design course. In
  464. 19:40my web design course, you're going to
  465. 19:42learn how to do a more advanced design.
  466. 19:45You're not going to see the CSS
  467. 19:47properties anymore, you're simply going
  468. 19:49to use them and in the end, the result
  469. 19:52that we're using with this course is
  470. 19:54this, a website with a different menu.
  471. 19:58We have a fully functional slider. It's
  472. 20:00a different website structure. As you
  473. 20:03can see, we also have our sidebar, our
  474. 20:06articles, a different footer. Well, I
  475. 20:09recommend that you watch this course,
  476. 20:11it's also quite good, it will help you
  477. 20:14practice and create your own websites.
  478. 20:16Well, that's all for this chapter, this
  479. 20:19last regular chapter of the CSS course.
  480. 20:22You already know that my name is Carlos
  481. 20:24Arturo. If you liked the CSS and HTML
  482. 20:26course, please subscribe, follow me on
  483. 20:28Twitter, don't forget to visit my
  484. 20:30website where I'm writing very good
  485. 20:32articles about web design and I'll see
  486. 20:34you next time. If you liked the video,
  487. 20:37please don't forget to subscribe to the
  488. 20:39channel, as well as follow me on
  489. 20:41Twitter at @falconmasters. Finally, I
  490. 20:43invite you to visit my website
  491. 20:45www.falconmasters.com where you will
  492. 20:47find tutorials and resources about web
  493. 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.