CSS学习笔记总结和技巧_html/css_WEB-ITnose
跟叶老师说项目,他叫我写一个静态首页,看起来挺简单的,但是下手才发现在真的不会怎么下手啊,什么模型啊模块啊都不懂,写毛线啊!!
如图:页面下拉还有侧栏,中间内容等。
可是答应跟老师做了,不能怂啊,于是硬着头皮,花两三天看在慕课网上学习Bootstrap(讲得挺好的,建议大白去看一下),其实我刚看完不久,里面很多东西其实作者都总结得很不错,还有演示。
收获很多,打算再看一下HTML的div+css布局,花一两天时间就可以写完那个界面。就是这么自信,哈哈哈~ 不逼自己一把,你永远不知道自己有多优秀。
CSS的盒子模型,这个必须懂
这个图片是我看书看到的,觉得比较容易理解就拍下来了
选择器
一、基本分类:
1,标签选择器
2,类选择器class
3,ID选择器id
二、优先级:id > class > 标签
三、伪选择器:其实就是元素的一种状态
a:link:超链接被点前状态a:visited:超链接点击后的状态a:hover:悬停在超链接上的状态a:action:点击超链接时的状态
在定义这些状态时,有一个顺序:L V H A
id和class属性名称使用限制
无论是应用到div,还是其他对象的id中,同一名称的id在当前页面中只能使用一次,而class属性名称可以重复使用多次。
框架中百分比的关系
例如,container等外层div的宽度设置为80%,是相对浏览器窗口而言的比例。而后面content和side这两个内层div的比例是相对于外层div而言的,即在container宽度的基础上而言的。
visibility和display属性的区别
visibility和display都可以达到隐藏页面元素的目的,但是还是有区别的。
如果想隐藏某元素,但还想在页面上保留该元素的空间,则使用visibility:hidden。
如果想在隐藏某元素的同时,让其他内容填充空白空间,则使用display:none。
在HTML中导入CSS文件技巧
为了提高相同的样式的复用性以及可扩展性,可以将多个标签样式进行单独定义,并封装成css文件。
如:p.css div.css . . . 在一个总的css文件中使用css的import将多个标签样式文件导入到总的css文件中,
然后在HTML页面上,使用link标签导入这个总的css文件即可。
all.css@import url(“p.css”);@import url(“div.css”);在HTML中导入:<link rel=”stylesheet” href=”all.css”>
CSS属性书写顺序
建议遵循:布局定位属性 –> 自身属性 –> 文本属性 –> 其他属性。 尽量保证同类属性写在一起。
属性列举:
布局属性:margin、padding、float(包括clear)、position(top,right,bottom,left即上右下左)、display、visibility、overflow等。自身属性:width、height、background、border等。文本属性:font、color、text-align、text-decoration、text-indent等。其他属性:list-style(列表样式)、vertical-vlign、cursor、z-index(层叠顺序)、zoom等。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...
