Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css干货 #44

Open
hfc-advance opened this issue Nov 24, 2018 · 0 comments
Open

css干货 #44

hfc-advance opened this issue Nov 24, 2018 · 0 comments
Labels
CSS3 css相关知识

Comments

@hfc-advance
Copy link
Owner

设置文字居中,一行文字居中,多行文字的时候左对齐

<div class='container'>
    <p class='child'></p>
</div>
.container {
    text-align: center;
}
.child {
    display: inline-block;
    text-align: left;
}

父元素设置居中对齐,内部元素设置左对齐,并且设置成行内块状元素,设置成行内元素不行,因为行内元素不能设置宽和高以及对齐方式,所以没用

@hfc-advance hfc-advance added the CSS3 css相关知识 label Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS3 css相关知识
Projects
None yet
Development

No branches or pull requests

1 participant