发表于: 2018-10-28 22:00:40
2 709
今天完成的事情,完成了任务1和任务2
其中通过任务1学会了float浮动的方式,主要就是从左向右浮动left,从右向左浮动right,在任务1中,还学会了高度与宽度中px与vw的区别,
明天的计划是吧任务3做完,今天也把任务三看了看,主要遇到的问题就是其中文本内容还不知道怎么样随着浏览器的大小而自适应。
遇到的问题是在做任务一的时候九宫格作出来了,但是实现的效果确实要么拍成一排,要么拍成一列,其中没法实现九宫格的换行,其中自己尝试过运用</br>来实现换行,但是产生的效果却不是另起一行换行。后来去百度上搜索,查阅任务一下面的其他师兄提出的问题以及向其他师兄寻求帮助,发现width以及height既然要实现自适应布局,就不能用px来给盒子赋予固定的值,不然根本不会产生变化,通过对比发现.1vw 等于视口宽度(viewport width)的百分之一,也就是说 100vw 就是视口的宽度。既然每一行3个格子,就设定width的值为30vw,3个格子一共占据宽度的百分之90,剩余百分之10作为边距,又因为九个格子的属性一样,所以把这九个格子定义成一个名称,如图所示
。
在进行任务2的时候发现github通过git上传代码是出现错误,报错内容为
error: src refspec master does not match any.
error: failed to push some refs to 'github.com/Wa-Fe/task'
后来通过查阅资料用命令
git commit
解决问题,。但是在上传完成后发现上传的项目只把html和css文件上传上去,没有产生文件夹。后来又把项目删除重新上传,先定位到需要上传文件所需要的目录,先执行
git init
命令,会在文件夹内产生一个以 .git开头的隐藏文件夹,然后执行第二步
git add .
准备上传,再执行第三步
git commit -m "first commit"
添加说明,最后执行
git push -u origin master
发现报错
To github.com:Wa-Fe/task
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:Wa-Fe/task'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
。遇到这种情况首先要把git pull到本地在重新上传,再次执行
git push -u origin master
上传成功。
通过今天学习到px与vw的区别,以及上传项目的步骤,依次执行下列命令即可成功
git init
git add .
git commit -m "first commit"
git remote add origin git@github.com:Wa-Fe/css.git
git push -u origin master
再次上传项目只需要执行
git add .
git commit -m "first commit"
git push -u origin master
评论