简体   繁体   中英

the div background appears white with zooming

I have an issue with zooming, if any div has background color/border it appears completely white when i zooming in it.

I try zooming in Facebook site and this issue didn't appear.

This image can make the issue more clearly.

在此处输入图片说明

So what is the problem ?

HTML header css

header {
  border-bottom: 1px solid #d6d6d6;
  width: 100%;
  padding-bottom: 10px;
  background-color: #BF0404;
  color: white;
  background-position:bottom;
}

if problem show once you have an horizontal scrolling bar at bottom of your window ,

then do not use width:100% . This is defaut value of block element anyway, it is useless for element kept in the flow;.

width:100% will shrink it's layout on screenwidth (or parent if it has a valid width in CSS).

To allow your header to grow beyond parent's width , give it a layout that allows it to naturally expand (or shrink).

header {
  min-width:100%;/* as a block element , it should cover all width avalaible, make sure it does */
  display:table;/* will expand , so background will too*/
}

DEMO

It seems you have a fixed width. Try : width:100% on your div

必须将宽度设置为菜单的100%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM