博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【codecademy summary】html+css box model content
阅读量:4314 次
发布时间:2019-06-06

本文共 2690 字,大约阅读时间需要 8 分钟。

padding

The space between the contents of a box and the borders of a box is konwn as padding.

exmaple:

  padding: 10px;

or

  padding: 5px 10px 5px 10px; ( top right bottom left )

or

  padding: 5px 10px; ( top& bottom left& right)

or

  padding-top

  padding-right

  padding-bottom

  padding-left

 

-------------------------------------------------------------------------------------------------------------------

margin

The margin refers to the sapce directly outside of the box. We can adjust this spacing with the margin property.

exmaple:

  margin: 20px;

or 

  margin: 6px 12px 6px 12px; ( top right bottom left )

or

  margin: 6px 12px;

or

  margin-top

  margin-right

  margin-bottom

 

When margin: auto is uesd, anelements will center relative to its container. But the width of div must be less than the width of the class body.

 

-------------------------------------------------------------------------------------------------------------------

The code in the example above resets the default margin and padding values of all HTML elements.It is often the first CSS rule in an exernal stylesheet.

exmaple:

  *{

    margin: 0;

    padding: 0;

   }  

 

-------------------------------------------------------------------------------------------------------------------

dispaly 

Modifying the display property of an element can help achieve a desired layout for a web page. The dispaly property can take on one of four values:

 

  inline - cause block-level elements(like a div) to behave like an inline element (like a link)

  block - cause inline elements(like a link)t to behave like a block element (like a div)

  inline-block - causes block-level elements to behave like an inline element, but retain the feature of a block-level element.

  none - removes an element form view. The rest of the web page will act as if the element does not exit

 

In the example above, the block-level list items will now behave as inline elemnets. The result will be list items appearing on the same line, like a navigation bar.

-------------------------------------------------------------------------------------------------------------------

visibility

The visibility property can be set to one of the following values:

  hidden - hides an element.

  visible - displays an element.

Notice:

What's the difference between display: none and visibility: hidden ?An element with display: none will be completely removed from the web page. An element with visibility:hidden ,however, will nor be visible on the web page, but the space reserved for it will. But all that still can view the contents of the list item by viewing the source code in their browser.

转载于:https://www.cnblogs.com/guangluwutu/p/6552545.html

你可能感兴趣的文章
Oracle 中wmsys.wm_concat拼接字符串,结果过长报错解决
查看>>
angularjs基础——控制器
查看>>
前端设计师如何提高UI界面中的阅读性
查看>>
APP版本号记录
查看>>
母函数
查看>>
最长不重复子串
查看>>
POJ 3621
查看>>
PHP ajax实现数组返回
查看>>
java web 自定义filter
查看>>
J.U.C Atomic(二)基本类型原子操作
查看>>
POJ---2945 Find the Clones[字典树-简单题(多例输入注意删除)]
查看>>
[Luogu4550] 收集邮票
查看>>
Python-循环
查看>>
(转)最大子序列和问题 看着貌似不错
查看>>
thinkphp3.2 链接数据库测试
查看>>
项目的上线流程是怎样的?
查看>>
Linux通配符
查看>>
ES6 Iterator
查看>>
Apache2.4开启GZIP功能
查看>>
远程桌面关闭重启电脑的方法
查看>>