Search
 
SCRIPT & CODE EXAMPLE
 

CSS

box model properties

/* Margin: Sets the margin as top, left, bottom, or right. */
margin: top right bottom left;

/* Padding: Sets the padding as top, left, bottom, or right. */
padding: top right bottom left;

/* Width: Sets an element's width as absolute units or auto. */
width: auto;

/* Height: Sets an element’s height as absolute units or as auto. */
height: auto;

/* Overflow: specifies what should happen if content overflows an element's box. */
overflow: hidden;

/* Visibility: Switches of the visibility of the element but the space occupied. */
visibility: visible;

/* Display: It defines how elements are displayed on the web page. */
display: block;

/* Float: Allows text to wrap around an element */
float: none;

/* Position: It specifies the positioning method of the HTML entity on the web page. */
position: sticky;
Comment

The Box Model

button {
    font-size: 20px;
    padding: 13px;
    border-width: 0px;
    margin: 8px;
}
Comment

CSS Box Model

THE BOX MODEL:
- Height : default: 0 / height of the content; 
- Width : the width that element needs, pushes other elements to side
- Margin : Outside space of an element that pushes other things away from the element
- Padding : Inside space of an element that pushes elements away from the border.
- Border : Outline for an element, outside the element eg.(300px*300px) add border: 303px*303px
Comment

css box model

div {
    width: 50px;
    height: 50px;
    padding: 10px;
    border: 2px solid black;
    margin: 5px;
}
Comment

css box model

/********************** CONTENT *************************
The box that contains the actual element content like text, 
image, icon, gif, video,... */

tag_name {
  height: 90px;
  width: 200px;
}

/********************** PADDING *************************
Distance between the content and the border. The background color,
of the element will never affect this space. But you can see this by
contrasting with the background color of the parent element that
contains your element*/

tag_name {
  padding-top: 50px;
  padding-right: 30px;
  padding-bottom: 50px;
  padding-left: 80px;
}

/*OR: */

tag_name {
  padding: 25px 50px 75px 100px;  /* top; right; bottom; left */
}

tag_name {
  padding: 25px 50px 75px; /* top; right_&_left; bottom */
}

tag_name {
  padding: 25px 50px;  /* top_&_bottom; right_&_left */
}

tag_name {
  padding: 25px; /* top_&_bottom_&_right_&_left */
}


/********************** BORDER *************************
You can define a frame for your element's box. You can 
only see the border, after you define a style for that 
property */

tag_name {
  border-width: 5px 70px 10px 28px; /* or border-bottom-width: 10px; ... */
  border-color: blue;  /* or border-top-color: #b52e2e; ... */
  border-style: dotted; /* or dashed, or solid, or ... */
  border-radius: 70%  /* making the corners more rounded */
}

/*OR: */

tag_name {
  border: 5px solid red;      /* all_widths; style; color */
}

tag_name {
  border-left: 6px dotted green;   /* width; style; color */
  border-top: 34px groove yellow;   /* width; style; color */
}


/********************** OUTLINE *************************
It's a line that's drawn around your html element, but 
contrary to the border, the dimensions of the outline 
aren't taken into account. It's drawn around elements, 
outside the borders, to make the element "stand out" */

tag_name {
  outline-width: thin; /* or medium; thick; outline-width: 4px; ... */
  outline-color: blue;  /* or #b52e2e; invert; ... */
  outline-style: dotted; /* or dashed, or solid, or ... */
  outline-offset:   /* making the corners more rounded */
}

/*OR: */

tag_name {
  outline: dashed;  
}

tag_name {
  outline: dotted red;
}

tag_name {
  outline: 5px solid yellow;    /* all_widths; style; color */
}

tag_name {
  outline: thick ridge pink;
}



/********************** MARGIN *************************
This is the distance that separates an html element, 
from the other elements around it. The background color, 
of the element will never afect this space, because the 
margin doesn't have background color. The margin is an 
invisible border or space between two objects */

tag_name {
  margin-top: 100px;
  margin-bottom: 100px;
  margin-right: 150px;
  margin-left: 80px;
}

/*OR: */

tag_name {
  margin: 25px 50px 75px 100px;  /* top; right; bottom; left */
}

tag_name {
  margin: 25px 50px 75px;  /* top; right_&_left; bottom */
}

tag_name {
  margin: 25px 50px; /* top_&_bottom; right_&_left */
}

tag_name {
  margin: 25px; /* top_&_bottom_&_right_&_left */
}
Comment

css box model

MDN (Mozilla Developer Network)
Probably the best place for an in-depth explanation of
web related technologies.

See the link below regarding the CSS BOX MODEL
Comment

PREVIOUS NEXT
Code Example
Css :: text align in materialize css 
Css :: what is padding in css 
Css :: css colors 
Css :: css add space right 
Css :: custom checkbox 
Css :: how to set scss variables 
Css :: column count css 
Css :: Set cellpadding and cellspacing in CSS? 
Css :: transparent blur effect css 
Css :: css clip path text 
Css :: beautiful scrollbar css 
Css :: react use global css classes 
Css :: grid all items same height 
Css :: grid template css 
Css :: how to make jest parse the imported css modules in create react app 
Css :: freecodecamp hide content using css 
Css :: Why CSS background color not show with float? ,use of float disappear parent div background color d 
Css :: punderline none 
Css :: grippy css 
Css :: z-index: 1000000; 
Css :: i tag in html , <i tag in html 
Css :: swipe animation css 
Css :: -moz-background-inline-policy 
Css :: how to scroll only in one direction in css 
Css :: -webki slider runnable track 
Css :: tailind css cdn 
Css :: var units = "years"; var davidAge = 65; var johnAge = 40; var ageDifference = davidAge - johnAge; alert("The age difference is " + ageDifference + " " + units); 
Css :: css widows 
Css :: padding order nth-child 
Css :: formatage date css 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =