简体   繁体   English

根元素字体大小是否应该影响文本以外的元素?

[英]Should root element font size affect elements other than text?

Learning about rem and try to make whole website responsive.学习rem并尝试使整个网站响应。

According to the value of 1rem , should I be scaling:根据1rem的值,我应该缩放:

  1. Font sizes and margins/paddings around text字体大小和文本周围的边距/填充
  2. margins/paddings/size of elements that do not directly contain text like components and images不直接包含文本(如组件和图像)的元素的边距/填充/大小

Does this depend on the layout?这取决于布局吗?

For example, I have an image in a card component.例如,我在卡片组件中有一个图像。 As user increases the font size, image or space around it might stay small next to a larger font.当用户增加字体大小时,它周围的图像或空间可能会在较大字体旁边保持较小。

Should I let this happen or scale image with the font size?我应该让这种情况发生还是使用字体大小缩放图像? I know the setting in the browser only changes font size.我知道浏览器中的设置只会改变字体大小。 On Facebook, for instance, font size from browser settings does not affect the images or component sizes.例如,在 Facebook 上,浏览器设置中的字体大小不会影响图像或组件大小。

Should I then only worry about text?那么我应该只担心文本吗?

I think this is entirely based on context/preference but,我认为这完全基于上下文/偏好,但是,

  1. Generally yes, if you are using 'em' for padding/margin (which you should be) this will scale automatically however to the font-size of its element.通常是的,如果您使用 'em' 进行填充/边距(您应该这样做),这将自动缩放到其元素的字体大小。

  2. Depends on the element, text is hard to read for some people as its small lines in unique shapes so this makes the most sense to scale however images and other elements are generally a lot easier to look at.取决于元素,文本对于某些人来说很难阅读,因为它的小线条具有独特的形状,因此缩放最有意义,但图像和其他元素通常更容易查看。 - if the content of the element is something like an icon for button I would probably scale it with text as it is likely to be adjacent to some text so would look weird if the text scaled but the element didn't. - 如果元素的内容类似于按钮的图标,我可能会用文本缩放它,因为它可能与某些文本相邻,所以如果文本缩放但元素没有缩放,看起来会很奇怪。 Otherwise I would just use responsive web design such as flex/grid to fill the space of a page, this is "scaling" however less for accessibility and more for design.否则我只会使用响应式网页设计,例如 flex/grid 来填充页面的空间,这是“缩放”,但对于可访问性而言较少,而对于设计则较多。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不影响其他元素的情况下更改导航栏中 1 个元素的字体和字体大小 - How to change font and font size of 1 element in navbar without affecting other elements 如何响应地调整 html 文本元素的大小,但不相对于其他元素? - How to size an html text element responsively but not relative to other elements? 为什么具有较大字体大小的文本显示低于其他文本以及如何阻止它? - Why does text with a larger font-size show up lower than other text and how to stop it? 为什么文本对齐会影响子 div,但不会影响字体大小? - Why text-align affect child div, but not font-size? 输入元素高度大于字体大小 - input element height larger than font size 在没有文本的div上使用font-size将高度/其他属性的值传播到子元素 - using font-size on divs without text to propagate height/other property's value to child elements 我想将鼠标悬停在一个元素上以影响其他元素 - i would like hover one element to affect other elements css 当一个元素悬停时如何影响其他元素(不是兄弟或父元素) - How to affect other elements when one element is hovered (not sibling or parent) 悬停一个元素时如何影响其他元素 - How to affect other elements when one element is hovered 同一文本的字体大小不同(一部分文本为“ X”,另一部分为“ Y”) - Different font size for same text (one part of the text with font size “X” and other with font size “Y”)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM