HTML & CSS
381 subscribers
728 photos
1 video
4 files
54 links
πŸ‘Œ HTML & CSS
@html_css_tut

πŸ‘ŒJavaScript
@javascript_tut

πŸ‘Œ PHP
@php_tut


πŸ‘ŒAll About Coding
@codingWithElias
Download Telegram
Online Book Store - PHP & MYSQL Project

https://youtu.be/IMCHi-5Ig40
Online Book Store - Full PHP & MYSQL Project
HTML + Bootstrap 5

https://youtu.be/-qMnJJ_cUng
πŸ’ŽSet Font Size With Pixels

Setting the text size with pixels gives you full control over the text size:

πŸ“ŽExample:
-----------------------------
h1 {
  font-size: 60px;
}
-----------------------------

πŸ’ŽSet Font Size With Em

To allow users to resize the text (in the browser menu), many developers use em instead of pixels.

1em is equal to the current font size. The default text size in browsers is 16px. So, the default size of 1em is 16px.

The size can be calculated from pixels to em using this formula: pixels/16=em


πŸ“ŽExample:
-----------------------------
h1 {
  font-size: 3.5em;
}
-----------------------------

πŸ’ŽSet Font Size With REM

rem values are relative to the root html element, not to the parent element. That is, If font-size of the root element is 16px then 1 rem = 16px for all elements. If font-size is not explicitly defined in root element then 1rem will be equal to the default font-size provided by the browser (usually 16px).

When it comes to spacing and font-sizing, I prefer to use rem. Since rem uses root element’s font-size instead of its parent’s font-size.

πŸ“ŽExample:
-----------------------------
h1 {
  font-size: 2.5rem;
}
-----------------------------

@html_css_tut
"w3schools .com,
medium. com "
CSS Opacity

πŸ’ŽThe opacity property specifies the opacity/transparency of an element.

πŸ’ŽThe opacity property can take a value from 0.0 - 1.0. The lower value, the more transparent.

πŸ“ŽExample:
-------------------------------
img {
  opacity: 0.5;
}
--------------------------------

@html_css_tut
"w3schools .com"
Transparency using RGBA

πŸ’ŽIf you do not want to apply opacity to child elements, Use RGBA

πŸ“ŽExample:

/* Green background with 30% opacity */
------------------------------
div {
  background: rgba(76, 175, 80, 0.3) ;
}
--------------------------------

@html_css_tut
"w3schools .com"
CSS The !important Rule

πŸ’ŽThe !important rule in CSS is used to add more importance to a property/value than normal.

πŸ’ŽIn fact, if you use the !important rule, it will override ALL previous styling rules for that specific property on that element!

πŸ’ŽIt is good to know about the !important rule, you might see it in some CSS source code. However, do not use it unless you absolutely have to.

πŸ’ŽOne way to use !important is if you have to override a style that cannot be overridden in any other way. This could be if you are working on a Content Management System (CMS) and cannot edit the CSS code. Then you can set some custom styles to override some of the CMS styles.

@html_css_tut
"w3schools .com"
Fully Responsive Personal Site
Only HTML & CSS.

https://youtu.be/tjkIMVHMxDs
CSS Box Sizing

πŸ“ŒThe CSS box-sizing property allows us to include the padding and border in an element's total width and height.

πŸ’ŽWithout the CSS box-sizing Property

βœ… By default, the width and height of an element is calculated like this:

πŸ’Žwidth + padding + border = actual width of an element

πŸ’Ž height + padding + border = actual height of an element

πŸ”‘The box-sizing property allows us to include the padding and border in an element's total width and height.

πŸ”‘If you set 
box-sizing: border-box; 
on an element, padding and border are included in the width and height:

@html_css_tut
"w3schools .com"
πŸ“Œbox-sizing: border-box

πŸ“ŽThe code below ensures that all elements are sized in this more intuitive way. Many browsers already use box-sizing: border-box; for many form elements (but not all - which is why inputs and text areas look different at width: 100%;).

πŸ”‘Applying this to all elements is safe and wise:

________________

* {
  box-sizing: border-box;
}
_________________

@html_css_tut
"w3schools .com"