- This topic is empty.
-
AuthorPosts
-
April 2, 2019 at 7:37 am #285825rnbutler87Participant
Hi
I’m just experimenting with changing a template in wordpress but want to see if I can mockup a simple example first.
I’m trying to get the blue header full width. And then underneath, have the red and black sections next to each other, with the red box taking up 2 thirds of the space and the black box taking up the remaining third.
Here’s where I’ve got to: https://codepen.io/rnbutler87/pen/pBJVxg
Any help would be greatly appreciated.
RichardApril 2, 2019 at 8:41 am #285835Paulie_DMemberFrankly, the HTML structure looks messed up for this.
Yes…you’ll need to swap some things around. You want the
article
to be 66% wide but the header inside it to be 100% wide, that isn’t going to work.April 2, 2019 at 9:04 am #285836rnbutler87ParticipantMaybe I’m wrong, but as I understand it, the article tag is just there for semantic reasons; I actually want the .article-content to be 66%, not the entire article tag itself.
April 2, 2019 at 9:14 am #285837Paulie_DMemberRegardless, the header inside the element that is 66% wide can’t be 100% of the super-container.
To get the article next to the sidebar the article needs to be 66% wide which means your header can’t be 100% wide…see?
April 2, 2019 at 9:26 am #285838rnbutler87ParticipantSorry but I don’t understand, I’m probably being dense…! From how I thought I’d written the code, the header element isn’t inside anything that is 66%. The .article-content div is what I want to be 66% and the sidebar to sit next to it in the remaining space. Thanks for your patience…
April 2, 2019 at 10:47 am #285843Paulie_DMemberThe header is inside the article but the sidebar isn’t.
So they can’t be next to each other because they don’t share a parent container.
To make the header 100% wide, the article needs to be 100% but it can’t be because the article has to sit next to the side bar.
So, either the header comes out of the article or the sidebar goes in….then it’s possible.
April 2, 2019 at 11:26 am #285844rnbutler87ParticipantSo even though everything is in a flex container div, an article tag does not behave like a normal div?
April 2, 2019 at 11:26 am #285845rnbutler87Participant(and I really want to get my head around this so thank you for taking the time to explain it!!)
April 2, 2019 at 12:52 pm #285847Paulie_DMemberSo even though everything is in a flex container div, an article tag does not behave like a normal div?
It is acting like a normal div…but the fact that it’s in a flex container won’t make any difference.
The article and sidebar are both children of the flex container so if the sidebar is 33% wide what does that leave for the article…67% right?
So, if the article is a maximum of 67% wide, the header inside the article can’t be wider than that.
April 3, 2019 at 2:44 am #285870LearnTheNewParticipantAdjust the column and rows like example i have placed a code in your codepen test
.row{
display: flex;
flex-wrap: wrap;
width: 100%;
}
.col-4{width: 33.33%; background-color: black;}
.col-8{width: 66.67%;}April 3, 2019 at 3:47 am #285871rnbutler87ParticipantIn response to Paulie D: Hi, thanks again for the reply. I’ve looked again and it makes sense what you’re saying. The only thing I don’t understand is that the
<
header> tag is not inside the
<
article> tag. But but does that still get affected by the sidebar %?
EDIT Nm, I thought Header was outisde Article, it’s not….I need to go away and think about this.
I think what I’m trying to do is honour the Article tag semantics whilst having a full width header and article content with a sidebar. I’ve seen it on other sites and I wonder if its possible
April 3, 2019 at 7:48 am #285883Paulie_DMemberIf you can find an example of this design we can take a look at it and see how they did it!
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.