Giter Site home page Giter Site logo

fe-qa's People

Contributors

reygreen1 avatar

Watchers

 avatar  avatar

fe-qa's Issues

两数相加

写一个 sum 函数,接收两个字符串参数,返回它们代表的数字之和。

如:
808278745
sum('342', '465') => 807

sum('99', '9') => 108

思考:

  1. 直接转成整数相加会有什么问题?
  2. 进位如何处理比较合适?
  3. 假如有了符号标识,有了负数,有可能出现减法,该如何改进?

关于浮动清除(clear both)的相关问题

子元素浮动,父元素如何避免高度塌陷问题?

清除浮动可以使用在父元素中创建 BFC,这样父元素再计算高度的时候就会将浮动计算在内,这是 BFC 规则之一。

而另一种方法就是利用clear: both清除,而这种方法又可以分为空元素设置与伪元素设置。

所以以下解决方案中,对父元素单独设置 clear both 是不行的,其他方案符合预期。

  1. 给父元素添加 overflow: hidden;
  2. 在浮动元素下方添加空 div,并添加样式 clear: both;
  3. 设置父元素 :after{content: “”;clear: both; display:block;overflow: hidden;}

link 和 @import 的区别

1、从属关系区别

@import 是 CSS 提供的语法规则,只有导入样式表的作用;link 是 HTML 提供的标签,不仅可以加载 CSS 文件,还可以定义 RSS、rel 连接属性等。

2、加载顺序区别

加载页面时,link 标签引入的 CSS 被同时加载;@import 引入的 CSS 将在页面加载完毕后被加载。

3、兼容性区别

@import 是 CSS2.1 才有的语法,故只可在 IE5+ 才能识别;link 标签作为 HTML 元素,不存在兼容性问题。

4、DOM可控性区别

可以通过 JS 操作 DOM ,插入link标签来改变样式;由于 DOM 方法是基于文档的,无法使用 @import 的方式插入样式。

用法:
1)link的写法:
<link rel="stylesheet" href="index.css">
2)@import的写法:

<style type=”text/css”>
    @import url(“index.css”);
</style>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.