DESAIN WEB (FLEXBOX Part 1)
FLEXBOX
index.html :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link href="style.css" rel="stylesheet" />
<title>The Basic Language of the Web: HTML</title>
</head>
<body>
<!--
<h1>The Basic Language of the Web: HTML</h1>
<h2>The Basic Language of the Web: HTML</h2>
<h3>The Basic Language of the Web: HTML</h3>
<h4>The Basic Language of the Web: HTML</h4>
<h5>The Basic Language of the Web: HTML</h5>
<h6>The Basic Language of the Web: HTML</h6>
-->
<div class="container">
<header class="main-header clearfix">
<h1>📘 The Code Magazine</h1>
<nav>
<!-- <strong>This is the navigation</strong> -->
<a href="blog.html">Blog</a>
<a href="#">Challenges</a>
<a href="Flexbox.html">Flexbox</a>
<a href="#">CSS Grid</a>
</nav>
<div class="clear"></div>
</header>
<div class="row">
<article>
<header class="post-header">
<h2>The Basic Language of the Web: HTML</h2>
<div class="author-box">
<img
src="img/laura-jones.jpg"
alt="Headshot of Laura Jones"
height="50"
width="50"
class="author-img"
/>
<p id="author" class="author">
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
</p>
</div>
<img
src="img/post-img.jpg"
alt="HTML code on a screen"
width="500"
height="200"
class="post-img"
/>
<button>❤️ Like</button>
</header>
<p>
All modern websites and web applications are built using three
<em>fundamental</em>
technologies: HTML, CSS and JavaScript. These are the languages of
the web.
</p>
<p>
In this post, let's focus on HTML. We will learn what HTML is all
about, and why you too should learn it.
</p>
<h3>What is HTML?</h3>
<p>
HTML stands for <strong>H</strong>yper<strong>T</strong>ext
<strong>M</strong>arkup <strong>L</strong>anguage. It's a markup
language that web developers use to structure and describe the
content of a webpage (not a programming language).
</p>
<p>
HTML consists of elements that describe different types of content:
paragraphs, links, headings, images, video, etc. Web browsers
understand HTML and render HTML code as websites.
</p>
<p>In HTML, each element is made up of 3 parts:</p>
<ol>
<li class="first-li">The opening tag</li>
<li>The closing tag</li>
<li>The actual element</li>
</ol>
<p>
You can learn more at
<a
href="https://developer.mozilla.org/en-US/docs/Web/HTML"
target="_blank"
>MDN Web Docs</a
>.
</p>
<h3>Why should you learn HTML?</h3>
<p>
There are countless reasons for learning the fundamental language of
the web. Here are 5 of them:
</p>
<ul>
<li class="first-li">
To be able to use the fundamental web dev language
</li>
<li>
To hand-craft beautiful websites instead of relying on tools like
Worpress or Wix
</li>
<li>To build web applications</li>
<li>To impress friends</li>
<li>To have fun 😃</li>
</ul>
<p>Hopefully you learned something new here. See you next time!</p>
</article>
<aside>
<h4>Related posts</h4>
<ul class="related">
<li class="related-post">
<img
src="img/related-1.jpg"
alt="Person programming"
width="75"
height="75"
/>
<div>
<a href="#" class="related-link"
>How to Learn Web Development</a
>
<p class="related-author">By Jonas Schmedtmann</p>
</div>
</li>
<li class="related">
<img
src="img/related-2.jpg"
alt="Lightning"
width="75"
height="75"
/>
<div>
<a href="#" class="related-link">The Unknown Powers of CSS</a>
<p class="related-author">By Jim Dillon</p>
</div>
</li>
<li>
<img
src="img/related-3.jpg"
alt="JavaScript code on a screen"
width="75"
height="75"
/>
<a href="#">Why JavaScript is Awesome</a>
<p class="related-author">By Matilda</p>
</li>
</ul>
</aside>
</div>
<footer>
<p id="copyright" class="copyright text">
Copyright © 2027 by The Code Magazine.
</p>
</footer>
</div>
</body>
</html>
flexbox.html :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Flexbox</title>
<style>
.el--1 {
background-color: blueviolet;
}
.el--2 {
background-color: orangered;
}
.el--3 {
background-color: green;
height: 150px;
}
.el--4 {
background-color: goldenrod;
}
.el--5 {
background-color: palevioletred;
}
.el--6 {
background-color: steelblue;
}
.el--7 {
background-color: yellow;
}
.el--8 {
background-color: crimson;
}
.container {
/* STARTER */
font-family: sans-serif;
background-color: #ddd;
font-size: 40px;
margin: 40px;
/* FLEXBOX */
}
</style>
</head>
<body>
<div class="container">
<div class="el el--1">HTML</div>
<div class="el el--2">and</div>
<div class="el el--3">CSS</div>
<div class="el el--4">are</div>
<div class="el el--5">amazing</div>
<div class="el el--6">languages</div>
<div class="el el--7">to</div>
<div class="el el--8">learn</div>
</div>
</body>
</html>
style.css :
* {
/* border-top: 10px solid #1098ad; */
margin: 0;
padding: 0;
}
/* PAGE SECTIONS */
body {
color: #444;
font-family: sans-serif;
border-top: 10px solid #1098ad;
position: relative;
}
.container {
width: 800px;
/* margin-left: auto;
margin-right: auto; */
margin: 0 auto;
}
.main-header {
background-color: #f7f7f7;
/* padding: 20px;
padding-left: 40px;
padding-right: 40px; */
padding: 20px 40px;
margin-bottom: 60px;
/* height: 80px; */
}
nav {
font-size: 18px;
/* text-align: center; */
}
article {
margin-bottom: 60px;
}
.post-header {
margin-bottom: 40px;
/* position: relative; */
}
aside {
background-color: #f7f7f7;
border-top: 5px solid #1098ad;
border-bottom: 5px solid #1098ad;
/* padding-top: 50px;
padding-bottom: 50px; */
padding: 50px 0;
width: 500px;
}
/* SMALLER ELEMENTS */
h1,
h2,
h3 {
color: #1098ad;
}
h1 {
font-size: 26px;
text-transform: uppercase;
font-style: italic;
}
h2 {
font-size: 40px;
margin-bottom: 30px;
}
h3 {
font-size: 30px;
margin-bottom: 20px;
margin-top: 40px;
}
h4 {
font-size: 20px;
text-transform: uppercase;
text-align: center;
}
p {
font-size: 22px;
line-height: 1.5;
margin-bottom: 15px;
}
ul,
ol {
margin-left: 50px;
margin-bottom: 20px;
}
li {
font-size: 20px;
margin-bottom: 10px;
/* display: inline; */
}
li:last-child {
margin-bottom: 0;
}
/* footer p {
font-size: 16px;
} */
/* article header p {
font-style: italic;
} */
#author {
font-style: italic;
font-size: 18px;
}
#copyright {
font-size: 16px;
}
.related-author {
font-size: 18px;
font-weight: bold;
}
/* ul {
list-style: none;
} */
.related {
list-style: none;
}
body {
/* background-color: orangered; */
}
/* .first-li {
font-weight: bold;
} */
li:first-child {
font-weight: bold;
}
li:last-child {
font-style: italic;
}
li:nth-child(even) {
/* color: red; */
}
/* Misconception: this won't work! */
article p:first-child {
color: red;
}
/* Styling links */
a:link {
color: #1098ad;
text-decoration: none;
}
a:visited {
/* color: #777; */
color: #1098ad;
}
a:hover {
color: orangered;
font-weight: bold;
text-decoration: underline orangered;
}
a:active {
background-color: black;
font-style: italic;
}
/* LVHA */
.post-img {
width: 100%;
height: auto;
}
nav a:link {
/* background-color: orangered;
margin: 20px;
padding: 20px;
display: block; */
margin-right: 30px;
margin-top: 10px;
display: inline-block;
}
nav a:link:last-child {
margin-right: 0;
}
button {
font-size: 22px;
padding: 20px;
cursor: pointer;
position: absolute;
/* top: 50px;
left: 50px; */
bottom: 50px;
right: 50px;
}
h1::first-letter {
font-style: normal;
margin-right: 5px;
}
h3 + p::first-line {
/* color: red; */
}
h2 {
/* background-color: orange; */
position: relative;
}
h2::before {
content: "TOP";
background-color: #ffe70e;
color: #444;
font-size: 16px;
font-weight: bold;
display: inline-block;
padding: 5px 10px;
position: absolute;
top: -10px;
right: -25px;
}
/* Resolving conflicts */
/* #copyright {
color: red;
}
.copyright {
color: blue;
}
.text {
color: yellow;
}
footer p {
color: green !important;
} */
/* nav a:link,
nav p {
font-size: 18px;
} */
.author-img{
float: :left;
margin-buttom: 20px;
}
.author{
float: left;
margin-top: 10px;
margin-left: 20px;
}
h1{
float: left;
}
nav{
float: right;
}
.clear{
clear: both;
}
.clearfix::after{
clear: both;
content: "";
display: block;
}
.container{
width: 1200px;
margin: 0 auto;
}
article{
background-color: red;
}
aside{
background-color: green;
width: 300px;
}
footer{
background-color: yellow;
}
.related{
list-style: none;
margin-left: 0;
}
aside{
background-color: #f7f7f7;
border: top 5px #1098ad;
border-bottom: 5px #1098ad;
padding: 50px 40px;
}
.container{
font-family: sans-serif;
background-color: #ddd;
font-size: 40px;
margin: 40px;
display: flex;
align-items: center;
justify-content: flex-start;
gap: 10px;
}
.el--1{
align-self: flex-start;
}
.el--5{
align-self: stretch;
order: -1;
}
.el--6{
order: -1;
}
.el{
flex: 1;
}
.container{
width: 1200px;
margin: 0 auto;
display: flex;
}
.main-header clearfix{
display: flex;
align-items: center;
justify-content: space-between;
}
.author-box{
display: flex;
align-items: center;
margin-bottom :15px ;
}
.author{
margin-bottom: 0;
margin-left: 15px;
}
.row{
display: flex;
align-items: flex-start;
gap: 75px;
margin-bottom: 6opx;
}
article{
flex: 1;
margin-bottom: 0;
}
aside{
defaults:
flex: grow 0;
flex: shrink 1;
flex-basis:auto;
flex:0 0 300px;
}
/* yut7 */
.related-post{
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 30px;
}
.related-link: link{
font-size: 17px;
font-weight: bold;
font-style: normal;
margin-bottom: 5px;
display: block;
}
.related-author{
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
font-style: italic;
}
/* class kenapa belajae */
.img{
background-color: yellow;
}
.k{
background-color: #1098ad;
}




Komentar
Posting Komentar