Many beginners to make Web pages of friends, may encounter a common problem, is to add margin:0 Auto in CSS, but no effect, can not center the issue, margin:0 auto; The meaning is: the upper and lower boundary is 0, the left and right according to the width of the self-adaptation, in fact, the meaning of the horizontal center, Here are two typical errors caused by a problem that cannot be centered:
1. No w
This article mainly introduces the CSS to achieve the horizontal scrolling effect of the picture, the need for friends can refer to, hope to help to hit everyone.
The specific code looks like this:
. imagelist{ overflow-x: auto; Overflow-y: Hidden; height:180px; White-space:nowrap; img{ Width:auto; height:100%; margin-right:10px; } }
Tip: You can modify some of the code before running
Pure CSS Horizontal level two navigation menu code
Tip: You can modify some of the code before running
The display of level two menus is not controlled using JavaScript, as shown in the results.The code is as follows:1 2 3 4 5 6 the the the the - in the the About the the the + - the Bayi the the - - the the the the - the the the 94 the the the 98 About Div+css to create a level two horizontal pop-up menu, slightly simpler
Li Wu:Heng Learn to think together, honouring teachers save Thanksgiving. Leaf See root three return to one, rivers the same oneness.Meekness Conscience Lord, willing to do without regrets to the most bitter. Reading exercises to keep the body and mind, sincere advice and the line and cherish.
Ide:visual Studio 2017
Browser:chrome
Os:win7
CodeDOCTYPE HTML>HTML>Head> MetaCharSet= "Utf-8" /> Metaname= "Author"content= "Https://www.cnblogs.com/jizuiku"/> title>title> s
Center vertically:1, single-line text, row higher than high, that is, Line-height equals the parent high;2, multiline text, parent settings relative positioning: position:relative, subset set absolute positioning, Position:absolute, first position to 50% position, that is top:50%, on the upward of the 50%, that is margin-top:- half of its height;3, vertically centered inline element, vertical-align:middle; He is positioned relative to the sibling row heights, and they are only valid for inline e
Directly on the code, just switch class to see the effectOperation Result:Center horizontally vertically relative to parent component (DIV)The effect is as follows:Several methods of vertical horizontal centering of CSS
Method One: div { position : absolute ; /* position:fixed can also */ left : 0 ; right : 0 ; top : 0 ; bottom : 0 ; width : 100px ; height : 100px ; margin : auto ; Background-color : green ;} Div > Div >Method Two: div { position : absolute ; /* position:fixed can also */ left : 50% ; top : 50% ; width : 100px ; height : 100px ; Margin-left : -50px ; Margin-top : -50px ; Background-color : red ;} Div > Div >Method Three: div { position : absolute ; /*
For a long time did not study CSS, all day with a variety of frameworks do not need to write their own, and recently to do a photo album page, encountered the first problem is how to arrange.
Give the design draft first and then say how the style is written
Analysis, there is a container, the container has padding, each row of each item and there is margin, the first thought is this
. container {
padding:10px
}
.Container. Item {
float:left;
w
Very depressing question, look at the code that I originally wrote:
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Actually appear the horizontal scroll bar, the problem is that I defined the width of only 950px Ah! Finally, with the help of netizens, found the reason:
1 can directly change the body's CSS to:
body{width:990px; margin:0
Lt;/div> . Ndyqfd_table_box{display:flex;}. Ndyqfd_ul{flex:none;}CSS style display:flex for outer div Inner Div or Li Flex:none that needs to be looped Table self-adapting horizontal scroll bar CSS
Css exercises-horizontal center of multiple elements in a container-flexbox layout application-all child elements in a parent element are centered
You only need to add a style to the parent element.
{Display: flex; flex-direction: column; align-items: center ;}
Set to the flexbox layout, which is arranged vertically and centered in the third sentence.
If you want to set the distance between the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.