程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了当显示器的大小发生变化时,如何正确调整社交媒体图标的大小?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决当显示器的大小发生变化时,如何正确调整社交媒体图标的大小??

开发过程中遇到当显示器的大小发生变化时,如何正确调整社交媒体图标的大小?的问题如何解决?下面主要结合日常开发的经验,给出你关于当显示器的大小发生变化时,如何正确调整社交媒体图标的大小?的解决方法建议,希望对你解决当显示器的大小发生变化时,如何正确调整社交媒体图标的大小?有所启发或帮助;

我一直在通过使用 max wIDth 和 max height 属性来更改高度和宽度,以检查当显示屏尺寸变小时图标布局是否会相应改变。然而,我一直无法得到我重新想象的结果。下面我有 HTML 代码,我有我想要实现的链接。基本上,如果屏幕太小,我宁愿每行有两个图标以使它们正确间隔开。如果 max-height 和 max-wIDth 没有帮助,我应该如何实现这一目标?如果屏幕尺寸足够大,我对带有标签的图标的布局很好,只是试图在屏幕较小时使其清晰显示。我的代码是下面故意包含的内容的一个较小的狙击手。

.picture {
  height: 32px; 
  wIDth: 32px; 
}
<a href="https://about.fb.com/k" ><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 1</span></a>                            
 <a class="social-link mr-2" href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 2</span></a> <a class="social-link mr-2" href="https://about.fb.com/k" target="_blank" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 3</span></a> <a class="social-link mr-2" href="https://about.fb.com/k" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png"/><span style="padding-left:3px">Label 4</span></a>

尝试实现的链接:https://share.sketchpad.app/21/bdc-02f4-1f5b64.png

解决方法

一种选择:

  • 将图标分成两个“行”。
  • 然后,使用 FlexBox,将各行彼此对齐,以便在大屏幕上显示为一行。
  • 设置 flex-wrap: wrap 以便在小屏幕上第二行移动到底部。

示例:

.picture {
  height: 32px;
  width: 32px;
}

.container {
  display: flex;
  flex-wrap: wrap;
}
<div class="container">
  <div class="row1">
    <a href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 1</span></a>
    <a class="social-link mr-2" href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 2</span></a>
  </div>
  <div class="row2">

    <a class="social-link mr-2" href="https://about.fb.com/k" target="_blank" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 3</span></a>
    <a class="social-link mr-2" href="https://about.fb.com/k" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 4</span></a>
  </div>
</div>

另一种选择(没有 FlexBox):

  • 将图标分成两个“行”。
  • 使行inline-block

示例:

.picture {
  height: 32px;
  width: 32px;
}

.row1,.row2 {
  display: inline-block;
}
<div class="container">
  <div class="row1">
    <a href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 1</span></a>
    <a class="social-link mr-2" href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 2</span></a>
  </div>
  <div class="row2">

    <a class="social-link mr-2" href="https://about.fb.com/k" target="_blank" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 3</span></a>
    <a class="social-link mr-2" href="https://about.fb.com/k" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 4</span></a>
  </div>
</div>

注意:如果您想在小屏幕上以不同的方式分隔图标,您可能需要使用媒体查询。

,

您可以为应用 display: inline-block 的两对使用两个容器,并使用一些其他设置在媒体查询中制作这些(全宽)块,如下所示:

.wrap_all {
  text-align: center;
}

.container1,.container2 {
  display: inline-block;
}

.picture {
  height: 32px;
  width: 32px;
}

@media (max-width: 480px) {
  .container1,.container2 {
    display: block;
    text-align: center;
  }
<div class="wrap_all">
  <div class="container1">
    <a href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 1</span></a>
    <a class="social-link mr-2" href="https://about.fb.com/k"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 2</span></a>
  </div>
  <div class="container2">
    <a class="social-link mr-2" href="https://about.fb.com/k" target="_blank" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 3</span></a>
    <a class="social-link mr-2" href="https://about.fb.com/k" rel="noopener noreferrer"><img class="picture" src="https://img.icons8.com/ios/452/facebook-new.png" /><span style="padding-left:3px">Label 4</span></a>
  </div>
</div>

,

lo que estas实施ando lo puedes hacer de varias maneras,sieres nuevo en programación web te recomiendo usar un framework llamado bootstrap en el cual puedes lograr lo que tu quieres,pero de igual forma te dejo pumas 2 Bootstrap 4 Tienes que tener instalado bootstrap dejo el link al sitio oficial: https://getbootstrap.com/docs/5.0/getting-started/introduction/

from jsonpath_ng import parse

jsonpath_expr = parse('$.objects[*].cow + $.objects[*].cat')
obj = {'objects': [
  {'cow': 2,'cat': 3},{'cow': 4,'cat': 6}
]}
values = [match.value for match in jsonpath_expr.find(obj)]  
print(values)

CSS3: para usarlo no es necesario instalar nada,pero puedes revisar la documentacion en el siguiente link https://www.w3schools.com/css/css_intro.asp de un curso que me ha enseñado la programación web。 Sin mas preámbulo dejo el link de como puedes implementationarlo con CSS。

Traceback (most recent call last):
  File "test.py",line 8,in <module>
    jsonpath_expr = parse('$.objects[*].cow + $.objects[*].cat')
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\jsonpath_ng\parser.py",line 14,in parse
    return JsonPathParser().parse(string)
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\jsonpath_ng\parser.py",line 32,in parse
    return self.parse_token_stream(lexer.tokenize(string))
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\jsonpath_ng\parser.py",line 55,in parse_token_stream
    return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\ply\yacc.py",line 333,in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\ply\yacc.py",line 1063,in parseopt_notrack
    lookahead = get_token()     # Get the next token
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\jsonpath_ng\parser.py",line 179,in token
    return next(self.iterator)
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\jsonpath_ng\lexer.py",line 35,in tokenize
    t = new_lexer.token()
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\ply\lex.py",line 386,in token
    newtok = self.lexerrorf(tok)
  File "C:\Users\micha\AppData\Roaming\Python\Python38\site-packages\jsonpath_ng\lexer.py",line 167,in t_error
    raise JsonPathLexerError('Error on line %s,col %s: Unexpected character: %s ' % (t.lexer.lineno,t.lexpos - t.lexer.latest_newline,t.value[0]))
jsonpath_ng.lexer.JsonPathLexerError: Error on line 1,col 17: Unexpected character: +

大佬总结

以上是大佬教程为你收集整理的当显示器的大小发生变化时,如何正确调整社交媒体图标的大小?全部内容,希望文章能够帮你解决当显示器的大小发生变化时,如何正确调整社交媒体图标的大小?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: