Solved

Getting 2 Divs next to each other

Posted on 2006-06-13
3
504 Views
Last Modified: 2008-02-01
This is a pretty simple problem, but it's late and I can't figure out what I'm doing wrong. Please help =)

I have two divs. One has a text area inside it. Once has some text. I want them to appear side-by-side. Instead, the text area takes up 100% of the container, and the labels get forced down below. Any ideas?

<div id="newNoteTextAreaContainer"><textarea class="newNoteTextArea" rows="30" cols="20"></textarea></div>
<div id="newNoteLabels">First Label, Second Label, Third Label</div>

Here are my styles:

.newNoteTextArea {
      width: 99%;
      font-family:Verdana, Arial, Helvetica, sans-serif;
      font-size:11px;
      padding: 3px;
      display:inline;
}
#newNoteTextAreaContainer {
      width: 80%;
      display: inline;
}
#newNoteLabels {
      width: 20%;
      display: inline;
}
0
Comment
Question by:aaron_karp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
bochgoch earned 500 total points
ID: 16892292
Try this...
.newNoteTextArea {
     width: 99%;
     font-family:Verdana, Arial, Helvetica, sans-serif;
     font-size:11px;
     padding: 3px;
     display:inline;
}
#newNoteTextAreaContainer {
     width: 79%;
     float:left;
}
#newNoteLabels {
     width: 20%;
     float:left;
}

...the floats should sort your positioning out, and reduce the width to 79% to allow space for margins, borders and widths...

bg
0
 
LVL 7

Expert Comment

by:maUru
ID: 16893000

<style>
.newNoteTextArea {
      display: inline;
}
.newNoteLabels {
      display: inline;
}
</style>
<textarea class="newNoteTextArea" rows="4" cols="20"></textarea>
<div class="newNoteLabels">First Label, Second Label, Third Label</div>


styling removed for brevity

i dont know why you want the container div

also can use:


<style>
.newNoteTextArea {
      float: right;
}
.newNoteLabels {
      display: right;
}
</style>
<textarea class="newNoteTextArea" rows="4" cols="20"></textarea>
<div class="newNoteLabels">First Label, Second Label, Third Label</div>
0
 
LVL 7

Expert Comment

by:maUru
ID: 16893026
explain exactly how you want it to display and ill fix up the code.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question