On this site you can find some gap above the footer. If I put margin-bottom: 0px; on .wrap the 50% gap created by the wrap margin disappears, but still there is a white gap, which I could not understand from where is that coming.
#2
One flex div has two sections:
one is set to 33%, max-width, and another one to
67%, but still is unable to take that full width and space is vacant there.
whats the fix?
I’m not sure if you realize that your header has a max-width of 1600px, the “wrap” has a max-width of 1400px, and the footer has no max-width. AND the three sections are not within a common “outer” wrapper, which normally makes life easier.
Do you think that setting a max-width for footer s going to solve the issue? If yes, please explain to me how?
let us discuss this part of additional clarity, and learning.
#Update:
for .footwo
I tried setting margin: auto, and it got aligned in the center. I think that could be a one fix to the issue #2
I am probably not going to be able to help you any further.
I start with the framing of a page and then add contents. You seem to have started without framing the page and want to band-aid the contents before fixing the framing.
Someone else will have to help you write bad code.
I have received an email 10 days back from an old member here that if the question is too generic and may help someone else in future than try posting that in an independent thread instead of messing up so many things in just one thread. I thought this could be the case now.
That was question #1 in this topic. It should be satisfied here. Coincidentally, it is also affected by the framing issue which needs to be addressed FIRST.
EDIT: @James_Hibbard has left a response in your other thread. Please check it out and see if it addresses your first issue satisfactorily. Then return here.
If you will look at your test page, you will find that all of the sections are left aligned at wide widths. Normally a page is centered within the window. If you are choosing to be a minimalist, then you must also keep track of the widths and centering margin in each section. An easier method is to put an “outer” div around the entire page and assign the max-width of the page to the outer div. The children of that outer div usually do not require a width to be set as they will extend to the width of .outer. That will be true for the header and footer as designed. In your design, the content section which is a div with the class of “wrap” will still need the min-width:1400px and margin:0 auto;. All of the rows of content will go inside that container, which is more appropriately the <main> tag nowadays.
One does not usually need to give the <header> and <footer> classNames, unless necessary.
the “outer” div is useful to keep the max width under control and to minimize errors caused by padding and borders on child elements.
You seem to have restored your test site to its previous state. I believe @James_Hibbard gave you the best solution for handling the margins. My “help” was not so helpful.
You do need to delete the bottom margin from div class="wrap" which can be done by assigning {margin:20px auto 0}, and you need to delete the bottom margin from the last “fcontent” box. That can be done with :last-child {margin-bottom:0} as shown by Pullo.
About the footer: The flex box is coded incorrectly. I’ll have to look up the correct code, or someone else can give it to you faster.
I would agree when the site is tightly controlled and self-built but there is a danger that if you globally target header or footer (or indeed any tag) then you may run into issues with third party plugins (especially in wordpress) which may use header and footer elements (as html5 allows multiple headers and footers).
For this reason I find it best to use classes and decouple your css from the html as much as possible.
Remove the width and use flex-grow to make it take available width.
Yes you can set min and max-widths if you want. You have to be careful though that your layout works with these dimensions otherwise content may not fit or the whole thing becomes too big on smaller screens if you are not wrapping with flex. You can usually work this out for yourself and then apply media queries to change the design to fit.
You can set the flex item to be a flex container also and that will allow the columns to align side by side.
By default flex items do not wrap which means they stay all in one line even when too large for the container and thus a scrollbar appears on the viewport or they stick out of the element.
Space-between will arrange the space between the elements evenly but for 2 elements only it will push the elements to the edges of the container. If you add a background to each element you will see that each item is only as wide as its content. If however you have used flex-grow on one of the items then there will be no space between anyway.
The easiest way to test is to take a simple code and add/remove things and see what happens.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
.wrap {
display:flex;
justify-content:space-between;
}
.wrap > div {
background:red;
/*flex:1 0 0; uncomment this to see the difference*/
}
</style>
</head>
<body>
<div class="wrap">
<div>Flex Item</div>
<div>Flex Item</div>
</div>
</body>
</html>
Make sure that topmenu has at least 20px right padding or it will sit on top of the icon because the icon is absolutely placed.
The text is centred because the last element (ccthemeplug) has a min-width of 4em (add a background colour to that last element to see that the element is centred).
That element needs a width because you are changing the text and without a width the line would jump when the text was change from themes to plugin. You can try shortening the min-width but you have to be careful you don;t crop the text as text size will vary in different browsers and also because the words are not the same length.
You have to be careful when adding effects that you don’t make the whole line judder or reflow as that can cause epileptic fits and is uncomfortable to view anyway.
Try 3em but you will never get it exact because one word is absolutely placed to avoid the page jump and needs a width to hold the space open.