Anonymous
Центральный текст в пограничных ящиках и центральной сетке по оси Y и справа от страницы
Сообщение
Anonymous » 07 май 2025, 21:38
Я пытаюсь сосредоточить текст, который находится в пограничных ящиках, которые я в конечном итоге поставлю за собой фоновое изображение, а также сосредоточиться на праве на веб -страницу сетки. Я попробовал отображение: Flex, Block и Inline Block, но он, кажется, никогда не сосредоточен на оси Y (я использовал Levify-Content для всех). Единственный способ, которым я смог сделать это,-это то, что я просто установил поля и прокладку в центр, но это испортит общий дизайн.
Код: Выделить всё
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
/* > THIS CSS < */
html {
background: #ADA996; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #EAEAEA, #DBDBDB, #F2F2F2, #ADA996); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #EAEAEA, #DBDBDB, #F2F2F2, #ADA996); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */}
/* name should be centered left */
#name{
font-family: "Tangerine", cursive, sans-serif;
align-content: center;
margin-right: 10%;
font-size: 6.5rem;
}
.overall-profile{
display: inline-grid;
max-width: 100%;
grid-template-columns: repeat(2, 1fr);
grid-auto-rows: 1fr;
align-items: center;
gap: 26px;
margin: 10% 5%;
}
#main-part{
display: inline-flex;
align-content: right;
justify-content: center;
}
@media (max-width: 532px) {
.overall-profile {
grid-template-columns: 1fr;
}
}
.overall-profile-image {
border-style: groove;
border-radius: 50px;
height: 20rem;
border: 10px solid black;
border-radius: 18px;
height: 380px;
width: 400px;
text-shadow: 2px 2px 3px rgba(0,0,0,.2);
box-shadow:
-6px -6px 26px rgba(255,255,255,.83),
5px 10px 15px rgba(0,0,0,.05),
15px 20px 35px rgba(0,0,0,.1),
inset -2px -2px 2px rgba(0,0,0,.1),
inset -1px -1px 3px rgba(255,255,255,.6),
inset 2px 2px 8px rgba(255,255,255,.2),
inset 1px 1px 8px rgba(255,255,255,.2),
-6px -6px 26px rgba(255,255,255,.8);
background-color: #e9e9ef;
margin: auto;
transition: 300ms ease-out;
cursor: pointer;
}
.overall-profile-image:hover {
box-shadow:
4px 4px 6px rgba(0,0,0,.2),
5px 10px 35px rgba(0,0,0,.1),
8px 10px 25px rgba(0,0,0,.1),
inset -1px -1px 9px rgba(0,0,0,.2),
inset -1px -1px 3px rgba(255,255,255,.6),
inset 1px 1px 8px rgba(255,255,255,1),
inset 4px 4px 24px rgba(0,0,0,.15),
-5px -5px 15px rgba(255,255,255,.9);
transform: scale(.98);}
/* Media queries will apply styles, depending on the check, for example, if the screen is smaller than 1200px */
@media (max-width: 1200px) {
#main-part {
/* align the flex items vertically */
flex-direction: column;
}
.overall-profile-image h1{
font-size: 1rem;
}
}
< /code>
Mawusi Amos
Mawusi Amos
Strength and Conditioning
Coding
Instructor
Personal Trainer
Подробнее здесь:
https://stackoverflow.com/questions/796 ... -of-the-pa
1746643125
Anonymous
Я пытаюсь сосредоточить текст, который находится в пограничных ящиках, которые я в конечном итоге поставлю за собой фоновое изображение, а также сосредоточиться на праве на веб -страницу сетки. Я попробовал отображение: Flex, Block и Inline Block, но он, кажется, никогда не сосредоточен на оси Y (я использовал Levify-Content для всех). Единственный способ, которым я смог сделать это,-это то, что я просто установил поля и прокладку в центр, но это испортит общий дизайн.[code]* { box-sizing: border-box; margin: 0; padding: 0; } /* > THIS CSS < */ html { background: #ADA996; /* fallback for old browsers */ background: -webkit-linear-gradient(to right, #EAEAEA, #DBDBDB, #F2F2F2, #ADA996); /* Chrome 10-25, Safari 5.1-6 */ background: linear-gradient(to right, #EAEAEA, #DBDBDB, #F2F2F2, #ADA996); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */} /* name should be centered left */ #name{ font-family: "Tangerine", cursive, sans-serif; align-content: center; margin-right: 10%; font-size: 6.5rem; } .overall-profile{ display: inline-grid; max-width: 100%; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; align-items: center; gap: 26px; margin: 10% 5%; } #main-part{ display: inline-flex; align-content: right; justify-content: center; } @media (max-width: 532px) { .overall-profile { grid-template-columns: 1fr; } } .overall-profile-image { border-style: groove; border-radius: 50px; height: 20rem; border: 10px solid black; border-radius: 18px; height: 380px; width: 400px; text-shadow: 2px 2px 3px rgba(0,0,0,.2); box-shadow: -6px -6px 26px rgba(255,255,255,.83), 5px 10px 15px rgba(0,0,0,.05), 15px 20px 35px rgba(0,0,0,.1), inset -2px -2px 2px rgba(0,0,0,.1), inset -1px -1px 3px rgba(255,255,255,.6), inset 2px 2px 8px rgba(255,255,255,.2), inset 1px 1px 8px rgba(255,255,255,.2), -6px -6px 26px rgba(255,255,255,.8); background-color: #e9e9ef; margin: auto; transition: 300ms ease-out; cursor: pointer; } .overall-profile-image:hover { box-shadow: 4px 4px 6px rgba(0,0,0,.2), 5px 10px 35px rgba(0,0,0,.1), 8px 10px 25px rgba(0,0,0,.1), inset -1px -1px 9px rgba(0,0,0,.2), inset -1px -1px 3px rgba(255,255,255,.6), inset 1px 1px 8px rgba(255,255,255,1), inset 4px 4px 24px rgba(0,0,0,.15), -5px -5px 15px rgba(255,255,255,.9); transform: scale(.98);} /* Media queries will apply styles, depending on the check, for example, if the screen is smaller than 1200px */ @media (max-width: 1200px) { #main-part { /* align the flex items vertically */ flex-direction: column; } .overall-profile-image h1{ font-size: 1rem; } } < /code> Mawusi Amos Mawusi Amos Strength and Conditioning Coding Instructor Personal Trainer [/code] Подробнее здесь: [url]https://stackoverflow.com/questions/79611177/center-text-in-border-boxes-and-center-grid-on-y-axis-and-on-the-right-of-the-pa[/url]