Home>
Always set, but position: relative;
After that, the arrangement is arranged with position: absolute with respect to the parent element of header-container.
Is there a way to set without using position?
<header>
<nav>
<ul>
<li>Top</li>
<li>Menu</li>
<li>About</li>
<li>Conpany</li>
<li>Contact</li>
</ul>
</nav>
<span></span>
<span></span>
<span></span>
<!-/ nav-toggle->
<!-/ js-black-bg->
<!-/ header-container->
</header><!-/ header->
/* header * /
header #header_bg {
background-image: url ("../ img/header_bg.png");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
padding-top: 61%;
position: relative;
}
header #header_bg .header_container {
max-width: 1340px;
width: 95%;
margin-left: auto;
margin-right: auto;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-moz-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 30px 0;
position: absolute;
top: 8%;
left: 50%;
-webkit-transform: translateY (-50%) translateX (-50%);
-moz-transform: translateY (-50%) translateX (-50%);
transform: translateY (-50%) translateX (-50%);
}
header #header_bg .header_container .header_logo h1.logo {
width: 220px;
}
header #header_bg .header_container .header_logo h1.logo a img {
width: 45%;
}
header #header_bg .header_container nav.globalnav ul.menu {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
}
@media screen and (min-width: 768px) {
header #header_bg .header_container .nav_toggle {
display: none;
}
}
@media screen and (max-width: 768px) {
header #header_bg .header_container {
display: block;
}
}
-
Answer # 1
Related articles
- css3 - the background image does not spread across the width
- css3 - i want to bring the background image to the front, but z-index does not work
- html - i want to place a background image under the global navigation …other
- css3 - i want to erase only the white part of the background image
- css3 - cannot display background image
- css3 - i want to place the user image in the comment field in the proper position
- ruby - background image cannot be displayed on heroku after deployment
- html - i want to display a django background image
- css3 - when i applied display: flex, the image shrank greatly, creating an extra gap
- css3 - [wordpress] specifying the background color from the management screen to the section including the article title
- [python] i want to display a background image in mr stickman game
- html - i want to put contents etc under the background image, where the footer menu comes up
- css3 - i want to make the image a sample size
- css3 - some images cannot be displayed as background images
- [flutter] i want to set an svg image in the container background
- css3 - characters move when clicking global navigation
- css3 - the background of the button disappears for some reason when it becomes a smartphone
- css3 - the verification on the pc and the image on the smartphone are different
- css3 - i want to place images at specific positions to make them responsive
- css3 - html&css background setting
Related questions
- css3 - about classes and web design in html5&css
- html - what is "reading" css_media queries?
- html - about width specification to check with developer tools
- html - i want to reflect media query settings
- css3 - "100vw" will not work if it falls below a certain width at the time of responsiveness
- php - the a tag does not move according to the specified width wordpress
- html - button tag does not have rounded corners
- html - css: overflow causes child elements to overflow
- html - z-index doesn't work in css
- html - does not fit in the body
This is the method I use often.
There may be a better way. .