Size of flex item is changed when I increase window's size on Chrome
I have a trouble when using flex box CSS, hope everyone help me. Flex item make text drop when responsive.
enter image description here
It's ok when window's size down and only Chrome get this trouble.
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
}
<ul class="career-nav">
<li><a href="#Citya" title="A City">City A</a></li>
<li><a href="#Cityb" title="Hanoi">City B</a></li>
<li><a href="#Cityc" title="Danang">City C</a></li>
</ul>
html css flexbox responsive
add a comment |
I have a trouble when using flex box CSS, hope everyone help me. Flex item make text drop when responsive.
enter image description here
It's ok when window's size down and only Chrome get this trouble.
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
}
<ul class="career-nav">
<li><a href="#Citya" title="A City">City A</a></li>
<li><a href="#Cityb" title="Hanoi">City B</a></li>
<li><a href="#Cityc" title="Danang">City C</a></li>
</ul>
html css flexbox responsive
flex-wrap: wrap;
make the flexible items wrap if necessary. developer.mozilla.org/docs/Web/CSS/flex-wrap
– Smollet777
Nov 21 '18 at 9:42
@Smollet777 thank you but it still dropping down, text "City A" is dropping down only window size changed, I do something it's working well (ex: delete anything line of code)
– Jed
Nov 22 '18 at 2:52
add a comment |
I have a trouble when using flex box CSS, hope everyone help me. Flex item make text drop when responsive.
enter image description here
It's ok when window's size down and only Chrome get this trouble.
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
}
<ul class="career-nav">
<li><a href="#Citya" title="A City">City A</a></li>
<li><a href="#Cityb" title="Hanoi">City B</a></li>
<li><a href="#Cityc" title="Danang">City C</a></li>
</ul>
html css flexbox responsive
I have a trouble when using flex box CSS, hope everyone help me. Flex item make text drop when responsive.
enter image description here
It's ok when window's size down and only Chrome get this trouble.
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
}
<ul class="career-nav">
<li><a href="#Citya" title="A City">City A</a></li>
<li><a href="#Cityb" title="Hanoi">City B</a></li>
<li><a href="#Cityc" title="Danang">City C</a></li>
</ul>
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
}
<ul class="career-nav">
<li><a href="#Citya" title="A City">City A</a></li>
<li><a href="#Cityb" title="Hanoi">City B</a></li>
<li><a href="#Cityc" title="Danang">City C</a></li>
</ul>
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
}
<ul class="career-nav">
<li><a href="#Citya" title="A City">City A</a></li>
<li><a href="#Cityb" title="Hanoi">City B</a></li>
<li><a href="#Cityc" title="Danang">City C</a></li>
</ul>
html css flexbox responsive
html css flexbox responsive
asked Nov 21 '18 at 9:26


JedJed
64
64
flex-wrap: wrap;
make the flexible items wrap if necessary. developer.mozilla.org/docs/Web/CSS/flex-wrap
– Smollet777
Nov 21 '18 at 9:42
@Smollet777 thank you but it still dropping down, text "City A" is dropping down only window size changed, I do something it's working well (ex: delete anything line of code)
– Jed
Nov 22 '18 at 2:52
add a comment |
flex-wrap: wrap;
make the flexible items wrap if necessary. developer.mozilla.org/docs/Web/CSS/flex-wrap
– Smollet777
Nov 21 '18 at 9:42
@Smollet777 thank you but it still dropping down, text "City A" is dropping down only window size changed, I do something it's working well (ex: delete anything line of code)
– Jed
Nov 22 '18 at 2:52
flex-wrap: wrap;
make the flexible items wrap if necessary. developer.mozilla.org/docs/Web/CSS/flex-wrap– Smollet777
Nov 21 '18 at 9:42
flex-wrap: wrap;
make the flexible items wrap if necessary. developer.mozilla.org/docs/Web/CSS/flex-wrap– Smollet777
Nov 21 '18 at 9:42
@Smollet777 thank you but it still dropping down, text "City A" is dropping down only window size changed, I do something it's working well (ex: delete anything line of code)
– Jed
Nov 22 '18 at 2:52
@Smollet777 thank you but it still dropping down, text "City A" is dropping down only window size changed, I do something it's working well (ex: delete anything line of code)
– Jed
Nov 22 '18 at 2:52
add a comment |
1 Answer
1
active
oldest
votes
The problem is that you are leaving your nav link with a default flex behaviour.
I would try to add a "flex" attribute to the links, at the same time it will be useful to set "nowrap" behaviour to the container
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: nowrap;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
flex: 0 0 auto;
}
fiddle: http://jsfiddle.net/fbxq74rw/
Tested on Chrome, Firefox and Safari
1
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Solved, try the fiddle. You have to be more specific on your flex setting for links. withflex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only byjustify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
1
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408870%2fsize-of-flex-item-is-changed-when-i-increase-windows-size-on-chrome%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is that you are leaving your nav link with a default flex behaviour.
I would try to add a "flex" attribute to the links, at the same time it will be useful to set "nowrap" behaviour to the container
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: nowrap;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
flex: 0 0 auto;
}
fiddle: http://jsfiddle.net/fbxq74rw/
Tested on Chrome, Firefox and Safari
1
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Solved, try the fiddle. You have to be more specific on your flex setting for links. withflex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only byjustify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
1
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
add a comment |
The problem is that you are leaving your nav link with a default flex behaviour.
I would try to add a "flex" attribute to the links, at the same time it will be useful to set "nowrap" behaviour to the container
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: nowrap;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
flex: 0 0 auto;
}
fiddle: http://jsfiddle.net/fbxq74rw/
Tested on Chrome, Firefox and Safari
1
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Solved, try the fiddle. You have to be more specific on your flex setting for links. withflex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only byjustify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
1
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
add a comment |
The problem is that you are leaving your nav link with a default flex behaviour.
I would try to add a "flex" attribute to the links, at the same time it will be useful to set "nowrap" behaviour to the container
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: nowrap;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
flex: 0 0 auto;
}
fiddle: http://jsfiddle.net/fbxq74rw/
Tested on Chrome, Firefox and Safari
The problem is that you are leaving your nav link with a default flex behaviour.
I would try to add a "flex" attribute to the links, at the same time it will be useful to set "nowrap" behaviour to the container
.career-nav {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: nowrap;
}
.career-nav a {
position: relative;
display: inline-block;
font-size: 1.428em;
line-height: 1;
color: #000;
padding: 13px 0;
text-decoration: none;
transition: background .2s ease;
flex: 0 0 auto;
}
fiddle: http://jsfiddle.net/fbxq74rw/
Tested on Chrome, Firefox and Safari
edited Nov 21 '18 at 10:11
answered Nov 21 '18 at 9:43


PlasticPlastic
1,80521531
1,80521531
1
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Solved, try the fiddle. You have to be more specific on your flex setting for links. withflex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only byjustify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
1
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
add a comment |
1
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Solved, try the fiddle. You have to be more specific on your flex setting for links. withflex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only byjustify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
1
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
1
1
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Thanks, I tried it, but it is not working, original item size is 52 pixels, after I changed window's size, it had gotten down size. On firefox is ok
– Jed
Nov 21 '18 at 9:50
Solved, try the fiddle. You have to be more specific on your flex setting for links. with
flex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only by justify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
Solved, try the fiddle. You have to be more specific on your flex setting for links. with
flex: 0 0 auto
you are basically saying that they will not shrink or grow, space available will be shared only by justify-content: space-around;
– Plastic
Nov 21 '18 at 10:01
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
I would like to know why my answer was downvoted and from who.... Just to understand what he suggest as an alternative..
– Plastic
Nov 21 '18 at 12:51
1
1
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
I'm sorry about that, I don't know who did it. I'm very glad for your help, I think new chrome update had some problem for code, because I used to make that before and nothing like that
– Jed
Nov 22 '18 at 1:43
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
Have you tried my last update, I tested the fiddle on Chrome, Firefox and Safari
– Plastic
Nov 22 '18 at 9:49
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408870%2fsize-of-flex-item-is-changed-when-i-increase-windows-size-on-chrome%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
flex-wrap: wrap;
make the flexible items wrap if necessary. developer.mozilla.org/docs/Web/CSS/flex-wrap– Smollet777
Nov 21 '18 at 9:42
@Smollet777 thank you but it still dropping down, text "City A" is dropping down only window size changed, I do something it's working well (ex: delete anything line of code)
– Jed
Nov 22 '18 at 2:52