Mobile blog

No transforms won’t help you as the move items visually only just like relative positioning. They don’t move the element physically into a new flow of the document. Absolute positioning removes items from the flow and can only be used in controlled situations where the flow of the document is already taken care of.

Try to let elements naturally occur at the point you want using flexbox, or some other layout method and then you just need small margins or padding to space them out. Don’t use margins with high numbers because that means you have done it wrong. Most margin will just nudge elements to make space but once you say something like margin-left:300px the chances are you’ve done it wrong.

I have previously given you examples where I have coded your elements without the need for magic numbers or and limited positioning rules. If you design properly then you don’t need to always position things. You just make sure they are in the right place via the structure you use. For example you placed all those little square images individually with relative positioning when you could have used flexbox (or indeed floats) to align them horizontally and let them wrap without any positioning at all. However you have to build the html in a way that allows you to do that.

I can’t really teach you how to do it you just have to go away and practice :slight_smile:

2 Likes

Yes that would be better than relative positioning because you already have the clock taking up space in the flow so absolutely placing something on top is fine in this instance.

2 Likes

What about changing the px’s to em’s and % instead? Should I do that, or not necessarily?

I can’t really teach you how to do it you just have to go away and practice :slight_smile:

Hoping someone can, cause I can’t even teach myself. I’m just getting it all messed up. I tried removing position:relative totally, along with the top: and left: on the square images you were mentioning. It just threw off a couple of the other square images.

I think you need to take a step back as you are battling concepts outside of your skill level or knowledge.

You really need to take a small course on CSS layout techniques so that you get a basic understanding of the structure you need in order to lay things out successfully on a page. There are many free courses around or the paid ones on Sitepoint are very good.

You really need to spend a few weeks just getting to grips with the basic concepts rather than just throwing random rules at content until it appears to fit your needs.

I have been trying to teach you but even though I repeatedly tell you not to use things like relative positioning you continue to use it for virtually every element on your page. I realise that’s because you don’t yet understand how to layout pages properly and you are just doing it piecemeal. You really need to step away and work through some tutorials and examples and then things may start to make sense.

You must also pay attention to easy stuff.

e.g. you have a calendar wrapper div.

.calendar-wrapper {
    width: 299px;
    height: 297px;
    margin: 1rem 0;
    border-radius: 5px;
    position: relative;
    cursor: default;
}

That element has a fixed height of 297px yet to have decided to put every single item in your column inside that div! It was just supposed to wrap the calendar and is only 297px. How can you expect content that is about 1000px (or more) tall to fit inside properly? That’s not CSS that’s just common sense to know that there would be a problem there.:slight_smile:

You also place separate elements on top of other separate elements instead of creating and grouping a proper structure for the task in hand. All those follower images are magic numbered into place one at a time. They could have all been lined up with a few lines of code and no positioning.

As I said I can tell you how things should be but I can’t make you learn. You have to do that for yourself. I have given you in depth instruction on how pages are laid out and how you should approach things so now its up to you to go away and practice some methods and then you can come back and start tidying up your code. :slight_smile:

3 Likes

“to have decided to put every single item in your column inside that div!”

What other items are in the div? I would never do that :blush: .

All of the them. All the left column is inside the calendar wrapper. You can see for yourself in devtools.

2 Likes

Ok I’ll look into it soon. Thanks :slight_smile:

Only code I could see that’s inside the calendar-wrapper div is this :

<!-- Start of WebFreeCounter Code -->
		<a style="text-decoration:none; text-shadow:none;" href="https://feeds.feedburner.com/WriterOnWheels">
		<div class="counterwrapper"><p class="subscriptiontitle">readers</p>
		<div id="messenger"></div>
		<a class="fbcount" href="https://feedburner.google.com/fb/a/dashboard?id=3d2rlagcc27seqa1a7ser3hlo8" title="Jump to the Analyze tab for this feed">3</a>
		<div class="counter"></div>
		<div style="color:gray; font-size:6px; font-family:Small Fonts, Helvetica, Arial, Verdana; position:relative; top:-27px;left:5px;letter-spacing:1px;">BY&nbsp;&nbsp;&nbsp;&nbsp;FEEDBURNER</div>
		</div>
		</a>
		<!-- End of WebFreeCounter Code -->
		
		<div class="rainbow"></div>
        <div class="rainbowreflection"></div>
        
        <div id="playhouse">
            <div class="blackcat"></div>
            <div class="blackcat2"></div>
        </div>

		<div class="box shine-animationtop"></div>
		<div class="box shine-animation"></div>
		
		<div class="quoteandpic"></div>
		<div class="myDIV"><div class="blurred"></div></div>
		<div class="speech">
  		  <p>Hey!</p>
		</div>
		

Other than that everything else in that wrapper looked like it belonged. I don’t have a good eye for spotting code that doesn’t belong in a particular div, so I still might have missed more.

Started working on this

Think it looks good, but the last two images bother me, as they aren’t aligned like the previous two rows.

You can get rid of 90% of that code and just use this only.

body {
  background: #333;
}
.myfollowers {
  color: white;
  font-family: Fertigo Pro, Open Sans, Karla, Arial, Lucida Sans, Georgia,
    Verdana;
  font-weight: bold;
  font-size: 21px;
  text-shadow: 0px 0px 1px black, 0px 0px 1px black, 0px 0px 1px black,
    0px 0px 1px black, 0px 0px 1px black, 0px 0px 1px black, 0px 0px 1px black,
    0px 0px 1px black, 0px 0px 1px black, 0px 0px 1px black, 0px 0px 1px black,
    0px 0px 1px black, 6px 0px 12px #0b051c, -6px 0px 12px lightblue;
}

#followercontainer {
  display:flex;
  width: 122px;
  flex-flow: row wrap;
  margin-top: 12px;
  padding:0 0 8px;
  background: blue;
}

#followercontainer > div {
  width: 30px;
  height: 30px;
  margin: 8px 0 0 8px;
}
#followercontainer > div img {
  width: 30px;
  height: 30px;
}

Don’t repeat things that are all the same hundreds of times.

1 Like

Thanks I’ll have that in mind. Looking into this tutorial for now

1 Like

I think I sparked my eureka moment with this, thanks to the tutorial.

Just one problem. I put it on my blog, it’s waaaaaay down there, and not aligned with its header.

Problem fixed. I think… added

margin:-47em 12em;

No not really.

That’s a magic number again.

If you have coded correctly the element should be in the right position to start with.

Work out why you have to do silly things like that.

4 Likes

You’ve put it inside the .calendar-wrapper div, along with all the other things Paul pointed out which don’t belong there.

3 Likes

Blockquote You’ve put it inside the .calendar-wrapper div, along with all the other things Paul pointed out which don’t belong there.

Yes, I’m aware of that issue. Will get to that soon. Haven’t forgotten. But I’m bothered with the fact that Paul says I’m using magic numbers. I want to fix this. I just don’t see how.

There is little point (it seems to me) in “fixing” the layout with the HTML structure incorrect, and then correcting the HTML structure and fixing the layout all over again.

As I’m sure we’ve said before, start by getting the basic HTML structure correct, and then add CSS. You don’t wallpaper your walls and then go back to fix the holes in the underlying plaster, but that’s what you’re trying to do here.

3 Likes

You don’t wallpaper your walls and then go back to fix the holes in the underlying plaster

Course not. It’s not my intention. I guess I’m doing that without knowing I am.

start by getting the basic HTML structure correct, and then add CSS

If only I could find examples of this. I don’t know what I’m missing out. The issues I’m seeing for now are : removing the HTML from the calendar-wrapper, which will then require me to rearrange the other elements as they will fall out of place, and then figuring out how I can avoid using positioning so often. This one is still a challenge.

All we’re saying is to think about the structure of your site logically. There are no “examples” as such. You have been given advice on this already, by me and by Paul.

You just need to slow down and take it step by step. Trying to do everything at once will never work, and trying to fix the layout before you sort out the HTML is a waste of time.

Take everything which is not part of the calendar out of .calendar-wrapper. What is the next item in your column? Put a wrapper around all the elements connected with that (if there isn’t a wrapper there already). Move on to the next item and repeat, until everything is in it’s own “box” and can be taken out or moved around without affecting anything else. Remember to check your code in the HTML Validator to catch any typos or other errors.

Now you can move on to styling things so they look the way you want them to. Again, deal with one item at a time, in a logical order.

3 Likes