Moving a DIV

I want to move the red,blue,yellow box to the left as seen on this page. How come the style ID#symbols doesn’t move all the symbols classes ?

 <div id="symbol">
    <div class="symbol_visual"></div>
    <div class="symbol_create"></div>
    <div class="symbol_watch"></div>
  </div>
#symbol {
display:block;
margin: 0px 56px 0px 0px;
}

.symbol_visual {
float:right;
  width:160px;
	border: 1px green solid;
	height:150px;
	width: 100px;
  margin: 0px 85px; 10px 100px;
	background:yellow;
}
.symbol_create {
	width:160px;
	border: 1px green solid;
	height:150px;
	width: 100px;
margin: -1px 105px; 10px 100px;
	background:red;
	}
.symbol_watch {
	width:160px;
	border: 1px green solid;
	height:150px;
	width: 120px;
margin: -152px 210px; 10px 100px;
	background:blue;
	}

Side margins applied to the #symbol child divs prevent them from aligning to the left.

In the markup, arrange the divs in the order you want them to to appear. A left to right sequence of red, blue, yellow would be

<div id="symbol">
    <div class="symbol_create"></div>
    <div class="symbol_watch"></div>
    <div class="symbol_visual"></div>
</div>

Remove the margins from all three divs and float them left with

#symbol div {
	float:left;
}

I want to add some space at the top and the left for each symbol class. Due to the float margins and padding have no effect.

I fixed it, how come the DIV #Symbols does not move all the symbols classes?

If you want the same margin values on each then you could specify it once for all with

#symbol div {margin:20px 0 0 20px;}

Edit: it would be simpler for all styles that are common to the divs to go in the above rule. i.e.

#symbol div {
    border: 1px solid green;
    float: left;
    height: 150px;
    margin: 4px 0 0 4px;
    width: 100px;
}
.symbol_visual {
    background: yellow;
}
.symbol_create {
    background: red;
}
.symbol_watch {
    background: blue;
    width: 120px;
}

how come the DIV #Symbols does not move all the symbols classes?

You’ll need to be more specific in describing your intention. Are you wanting to position the #symbol div somewhere?

I want the #symbol div to position all the symbols classes simultaneously. I tried margins and it moved the #Intro div.

Let’s look at the content of the #intro div.

1. The #symbol div

Contains three divs that you wish to be positioned side by side. Being a div, it is a block element by default so does not need display:block; to be applied in CSS.

As a block element it occupies the width of the parent i.e. #intro.

#intro has a set width of 576px so that is the width occupied by #symbol.

2. A paragraph (p)

The position is set within rules for Content p (margin)) and #intro p (padding-top).

3. An image (img)

The position is set by margins within #intro img. A left margin of 580px pushes it outside the width of #intro, and top margin of -250px pulls it up from its normal position in the flow, where it would sit below the paragraph.

***

Is there a reason you’ve specified a width of 576px and height of 350px for #intro when its content extends beyond those dimensions?

If you wish there to be two sections side by side in #intro: #symbol and the paragraph on the left and the image on the right, then a different approach to positioning should be used, as well as setting #intro to be wide enough for its content or allowing it to extend to fit its parent, Content by not setting a width.

This example adds a floated container for the left content, allowing the image to sit on its right without any need for margin positioning jiggery-pokery. A width is set on #symbol, so you can center it within its parent if required.

<div id="intro">
  <div id="intro_one" >
	<div id="symbol">
		<div class="symbol_visual"></div>
		<div class="symbol_create"></div>
		<div class="symbol_watch"></div>
	<!-- #symbol --></div>
	<p>Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.</p>
<!-- #intro_one --></div>
	<img src="http://www.thecreativesheep.ca/construction/block.jpg" alt="LogoGraphic">
<!-- #intro --></div>
/* These rules replace the existing ones for the same selectors */

#intro {
	margin: 34px 20px 0 20px; /* balanced left and right, which you may not want */
	background: #FF8000;
}

#intro_one {
	float: left;
	width: 576px;
	background: #AA8000;
}

#symbol {
	overflow:hidden; /* contain the floated children */
	background: #CC9000;
	margin: 0px auto; /* if you want to center #symbol */
	width: 342px; /* to allow centering */
}

#symbol div {
    border: 1px solid green;
    float: left;
    height: 150px;
    margin: 4px 0 4px 4px;
    width: 100px;
}

.symbol_visual {
    background: yellow;
}

.symbol_create {
    background: red;

}
.symbol_watch {
    background: blue;
    width: 120px;
}

#intro p {
	margin-top:10px;
}

#intro img {
	margin-left: 6px; /* or give #intro_one the ame margin-right value */
}

If this isn’t what you’re aiming for then we need to know precisely how you want these three elements to appear in relation to one another and the rest of the layout, so please knock together a simple mockup.

It’s extremely close, but there are some problems with your code page.

I want #Intro (# = div) to remain a separate div it’s purpose will be to hold a background image. If it’s joined as in the case with your code I’ll have to place two images together and that will increase the page size. My goal is to move #symbol around freely without it affecting #Intro but since #Intro is the parent I don’t know how to go about that, without taking it out of the flow of the page which I don’t want to do.

Is there a reason you’ve specified a width of 576px and height of 350px for #intro when its content extends beyond those dimensions?

A background image.

I’m not understanding what you’re after. Sorry.

On a side issue, is the following rule intended to apply styles to #services_content AND all p elements throughout the page, or only p elements WITHIN #services_content?

It seems unlikely to want all paragraphs to be 35px high, but I’m ready to be surprised :slight_smile: If not, remove the comma.

#services_content, p {
color: white;
height: 35px;
}

I’m strictly talking about the #Intro Section. What are you talking about ? :slight_smile: My goal is to move the symbols DIV with all the symbols classes.

I’m talking about a paragraph in #intro that’s currently affected, possibly inadvertently, by the rule above. I thought that might interest you.

This is unlikely to move forward without you providing a mockup.

The paragraph will be of interest after this problem is solved.

I won’t provide a mock-up because the layout resembles my goal. When I move the ID#Symbols which is nesting the classes .Symbol_visual, _create, _watch it repositions the #Intro div. I want the #Symbols div to be independent of the #Intro div but I don’t want to break the flow of the page.

Victor do you understand, without a mock-up?

Nope. An accurate mockup is likely to help others to help you, but it’s your choice.

Bumping your own thread is frowned upon, so my friendly advice would be to post only if you have something new to add.

Fine, I’ll post a mock-up. I wasn’t bumping for attention mostly to try to explain it the best I could in written form.

This is the mock up. When I move #Symbol div I want Symbol_class to follow. Since #symbols div is a child of #Intro I can’t figure out how to solve without taking it out of the flow of the page which I prefer not too.

So you want to be able to move #symbol both horizontally and vertically. Is this because you haven’t yet decided a final location for it, or some other reason?

You’ve omitted the paragraph that is currently in #intro. How should the paragraph and #symbol div interact? For example, what should happen to the paragraph if #symbol is moved downwards?

Edit: this isn’t exactly what I had in mind. Can you do a mockup showing all your design elements, as you intend the final page to look, including background images?

Is this because you haven’t yet decided a final location for it, or some other reason?

I want to be able to reposition which as far as I know I can’t do with the symbols_class as a cluster.

You’ve omitted the paragraph that is currently in #intro. How should the paragraph and #symbol div interact? For example, what should happen to the paragraph if #symbol is moved downwards?

It should move just offset from the distance between #symbol and #intro p !

If you apply padding-top to #symbol it will move downward without affecting the position of the #intro div. It will move down both the paragraph and image.

As you want the paragraph to move down when #symbol is moved down, the paragraph does not need to wrap around #symbol so you can give #symbol overflow:hidden; making it contain it’s floated child divs.

This will alter the position of the paragraph because it’s position in the flow is below #symbol rather than to the top of #intro, so to reduce the gap you should switch from 175px padding-top to, let’s say, 20px margin-top.

But…

Due to the following styles all affecting the paragraph, you will find that adding the margin-top to #intro p will not work, because it is overriden by Content p.

#content p { /* affects all paragraphs in #content and its children */
  margin: 40px 10px;
}

#intro p {
  font-size: 0.6em;
  padding-top: 175px;
}

#services_content, p { /* affects all paragraphs in the page - possible error */
  color: white;
  height: 35px;
}

So, to specifically target the paragraph in question, modify the selector thus:

#content #intro p {
  font-size: 0.6em;
  margin: 20px 0 0 0;
}

This will override Content p, but you should also decide whether to allow the other rules above to determine height and color of this and other paragraphs, or whether to apply styles to specific paragraphs as required, case by case.

Do you really want this and all other paragraphs to be 35px in height? This is important as it relates to how the image is positioned.

If you follow these instructions you will have:

  • Added overflow:auto; to #symbol
  • Tested adding padding-top to #symbol
  • Amended the #intro p selector to Content #intro p
  • Removed the padding from Content #intro p
  • Added margin to Content #intro p
  • Considered how paragraphs are affected by multiple rules
  • Decided whether all paragraphs should have 35px height

Before considering the image, one more question:

Will the background you intend to use on #intro be a repeating image or a single one occupying the 576px width?

Slight change, before I proceed with what you wrote in message #19. I don’t want #Intro p to move when #Symbols moves. I want to keep the control of #Intro p the only reason why I have a concern is because #symbols_classes will probably have to be enlarged.