tnblog
首页
视频
资源
登录

html使用定位实现同心圆

3882人阅读 2022/3/25 11:41 总访问:840311 评论:0 收藏:0 手机
分类: 前端

方法1:div有层级关系

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. .lx {
  10. top: 30px;
  11. left: 450px;
  12. position: absolute;
  13. }
  14. .yangshi {
  15. border-radius: 50%;
  16. position: relative;
  17. }
  18. .yi {
  19. width: 500px;
  20. height: 500px;
  21. border: 20px solid brown;
  22. top: 30px;
  23. left: 30px;
  24. position: absolute;
  25. }
  26. .er {
  27. width: 300px;
  28. height: 300px;
  29. border: 20px solid aqua;
  30. top: 80px;
  31. left: 80px;
  32. position: absolute;
  33. }
  34. .sang {
  35. width: 200px;
  36. height: 200px;
  37. border: 20px solid chocolate;
  38. top: 30px;
  39. left: 30px;
  40. position: absolute;
  41. }
  42. .si {
  43. width: 100px;
  44. height: 100px;
  45. border: 20px solid darkmagenta;
  46. top: 30px;
  47. left: 30px;
  48. position: absolute;
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <div class="lx">
  54. <div class="yangshi yi">
  55. <div class="yangshi er">
  56. <div class="yangshi sang">
  57. <div class="yangshi si">
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </body>
  64. </html>

方法2:没有层级关系

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. body {
  10. margin: 0px;
  11. }
  12. .item {
  13. height: 100px;
  14. width: 100px;
  15. border-radius: 50%;
  16. box-sizing: border-box;
  17. position: absolute;
  18. }
  19. .circle1 {
  20. border: 7px solid blue;
  21. left: 300px;
  22. top: 300px;
  23. height: 100px;
  24. width: 100px;
  25. }
  26. .circle2 {
  27. border: 7px solid black;
  28. left: 250px;
  29. top: 250px;
  30. height: 200px;
  31. width: 200px;
  32. }
  33. .circle3 {
  34. border: 7px solid red;
  35. left: 200px;
  36. top: 200px;
  37. height: 300px;
  38. width: 300px;
  39. }
  40. .circle4 {
  41. border: 7px solid yellow;
  42. left: 150px;
  43. top: 150px;
  44. height: 400px;
  45. width: 400px;
  46. }
  47. .circle5 {
  48. border: 7px solid green;
  49. left: 100px;
  50. top: 100px;
  51. height: 500px;
  52. width: 500px;
  53. }
  54. </style>
  55. </head>
  56. <body>
  57. <div class="item circle1"></div>
  58. <div class="item circle2"></div>
  59. <div class="item circle3"></div>
  60. <div class="item circle4"></div>
  61. <div class="item circle5"></div>
  62. </body>
  63. </html>

欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739。有需要软件开发,或者学习软件技术的朋友可以和我联系~(Q:815170684)

评价

htmlAgilityPack 网页数据处理

HtmlAgilityPack网络数据处理新年新气象!祝大家新的一年里蓬勃发展,飞黄腾达,幸福健康!今天讲的是一款处理网络数据的框...

html/css样式

代码: &lt;!DOCTYPEhtml&gt; &lt;html&gt; &lt;head&gt; &lt;metacharset=&quot;utf-8&quot;/&gt; &lt;title&gt...

html转换为js,节省重复模块的编写时间

有些时候,我们需要多次应用到自己的布局块,我们可以通过将html代码装换成js文件来装取代码下次需要用到时,去引入对应的j...

.net core 使用AntiXSSLibrary,htmlSanitizationLibrary 防止xss攻击

先下载相关依赖:install-package AntiXSSLibraryinstall-package HtmlSanitizationLibrary下载成功后一个方法即可Sanitize...

小程序html解析如:后台添加的文章详情

项目中遇到在微信小程序里需要显示音乐文章的内容,文章内容是通过接口读取的服 务器中的富文本内容,是html格式的,小程序...

html5播放mp3

代码比较简单:&lt;audiocontrols&gt; &lt;sourcesrc=&quot;horse.ogg&quot;type=&quot;audio/ogg&quot;&gt; &lt;sources...

vue中的v-html

v-html可以把字符串当成一个html来渲染,而不是原样输出Html类似.net mvc中的@Html.Raw()方法&lt;divv-html=&quot;item.tit...

Sanitizer.GetSafehtmlFragment报错Could not load file or assembly

Sanitizer.GetSafeHtmlFragment报错Could not load file or assembly &#39;System.Configuration.ConfigurationManager我不...

Markdown转html的显示处理

数据库保存转化好的html格式,前台直接显示" class="reference-link">方法1 : 数据库保存转化好的html格式,前台直接显示m...

html+css3+js 实现生日快乐代码,动态生成效果

&lt;!DOCTYPEhtml&gt; &lt;html&gt; &lt;head&gt; &lt;metacharset=&quot;UTF-8&quot;&gt; &lt;title&gt;生日快乐&lt;/...

html li如何横向排列

li元素是块状元素,所以元素与元素之间才会换行,现在只要把li元素变成元素之间可以同行内联的块状元素就行了。代码如下:l...

vscode中html代码补全

下载一个插件:HTML Snippets 然后:点击 文件-首选项-设置在用户设置中加入一下设置即可 &quot;files.associations&quo...

python html编码解码

使用方法:html.escape(s)与html.unescape即可 import html s=&quot;&lt;div&gt;jsdlfjsl&lt;/div&gt;&quot; #html编...

uni-app用法与html标签的变化

以前是html标签,比如,现在是小程序组件,比如。那么标签和组件有什么区别,不都是用尖括号包围起来一段英文吗?其实标签...

html,juquy选中 下拉列表框选中

&lt;selectstyle=&quot;margin:20pxauto&quot;id=&quot;statees&quot;name=&quot;state&quot;&gt; &lt;optionvalue=&quot;...

html帮助类

生成一个name为username,id为username的文本框@Html.TextBox(&quot;username&quot;)生成一个生成一个name为Number,id为Nu...
这一生多幸运赶上过你.
排名
8
文章
227
粉丝
7
评论
7
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术