Solved

CSS, DIV, Fieldset

Posted on 2014-02-09
8
600 Views
Last Modified: 2014-02-14
Hello all;

I am trying to get something to work.
Below is the example code.

The id="CenterText"
Needs to NOT push the lines 1,2,3 down on the side, but to be able to grow
Without effecting anything around it.
I have something out of place, I am just not sure what or which one it is.

Here is the code.
<fieldset style="width:800px;">
<legend><span>this is my place</span></legend>
<div>
<span style="border:1px double #000;">to the left</span>
<span style="float:right; border:1px double #000;">to the right</span>
</div>
            
 <div>name(<span title="name">my name</span>)</div> 

<div>
<!--This needs to be in the middle, and as it grows, the sides do not expand, as they are doing now.
lines 1,2,3 are below, when they should be staying steady underneath the (name) -->
<div align="center" id="CenterText">
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
</div>


<div>1st line</div>				
<div>2nd line</div>
<div>3rd line</div>
</div>

</fieldset>

Open in new window


Thanks All
Carrzkiss
0
Comment
Question by:Wayne Barron
  • 5
  • 3
8 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39846381
Perhaps add a height and overflow scroll http://jsbin.com/kesor/1/edit?html,output
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <style>
    #CenterText{height:75px;overflow:scroll;}
    
  </style>
</head>
<body>
  <fieldset style="width:800px;">
<legend><span>this is my place</span></legend>
<div>
<span style="border:1px double #000;">to the left</span>
<span style="float:right; border:1px double #000;">to the right</span>
</div>
            
 <div>name(<span title="name">my name</span>)</div> 

<div>
<!--This needs to be in the middle, and as it grows, the sides do not expand, as they are doing now.
lines 1,2,3 are below, when they should be staying steady underneath the (name) -->
<div align="center" id="CenterText">
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
  information here<br/ >
  information here<br/ >
</div>


<div>1st line</div>				
<div>2nd line</div>
<div>3rd line</div>
</div>

</fieldset>
</body>
</html>

Open in new window

0
 
LVL 30

Author Comment

by:Wayne Barron
ID: 39846427
Hey Scott.
That will not work.
It is for posting comments, and to have an overflow scroll, would look to messy and unprofessional for this site.

The original code was built with a Table.
However, I am trying to step away from using Tables in this site, if possible.
Some area's will have them, but this area, I am hoping to completely remove tables all together.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39846433
I guess I don't understand your question then.  How can you add content without pushing the bottom down unless the bottom is perhaps a sticky footer?

We could put the "information here<br/ >" into div's that are floated left and they will form columns but at some point it will wrap and then push down the <div>1st line</div>.

Can you point to a test url for the way you are doing this now.
0
 
LVL 30

Author Comment

by:Wayne Barron
ID: 39846434
Getting there.
The only thing, is that if the text is longer, like what is written on this line right here, that you are reading.
Then it breaks the lines on the side.
So I need to find a way to make it not cross over to the left side, so I tried.
width:75%;
And that did not work.

Here is the updated code, and semi works.

<fieldset style="width:800px;">
<legend><span>this is my place</span></legend>
<div style="background-color:#666; color:#FFF;">
<span style="border:1px double #000;">to the left</span>
<span style="float:right; border:1px double #000;">to the right</span>
</div>
            
 <div>name(<span title="name">my name</span>)
 
 <!--This needs to be in the middle, and as it grows, the sides do not expand, as they are doing now.
lines 1,2,3 are below, when they should be staying steady underneath the (name) -->
 
 <span style="float:right; margin-right:50%;" id="CenterText">
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
information here<br/ >
</span>
 </div> 

<div>

<div><span>1st line</span></div>				
<div>2nd line</div>
<div>3rd line</div>
</div>

</fieldset>

Open in new window

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 30

Accepted Solution

by:
Wayne Barron earned 0 total points
ID: 39846451
I think that I have it!!!!!
The text does not break the side now.

<style type="text/css">
.Setwidth{
	min-width:590px; 
	width:100% !important;
}
</style>

<fieldset class="Setwidth">
<legend><span>this is my place</span></legend>
<div style="background-color:#666; color:#FFF;">
<span style="border:1px double #000;">to the left</span>
<span style="float:right; border:1px double #000;">to the right</span>
</div>
            
 <div>name(<span title="name">my name</span>)
 
 <!--This needs to be in the middle, and as it grows, the sides do not expand, as they are doing now.
lines 1,2,3 are below, when they should be staying steady underneath the (name) -->
 
 <span style="float:right; margin-right:1%; width:80%;" id="CenterText">
information hereinformation hereinformation hereinformation hereinformation hereinformation herehereinformationherehereinformationherehereinformationherehereinformation
information hereinformation hereinformation hereinformation hereinformation hereinformation herehereinformationherehereinformationherehereinformationherehereinformation
information hereinformation hereinformation hereinformation hereinformation hereinformation herehereinformationherehereinformationherehereinformationherehereinformation
information hereinformation hereinformation hereinformation hereinformation hereinformation herehereinformationherehereinformationherehereinformationherehereinformation
</span>
 </div> 

<div>

<div><span>1st line</span></div>				
<div>2nd line</div>
<div>3rd line</div>
</div>

</fieldset>

Open in new window

0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 39846467
I would have done this a little different and  use divs since those are already blocks.
<style>
#container{width:800px;}
#names{width:200px;float:left;margin-right:10px;}
#information{width:580px; float:left;}
</style>
<div id="container">
   <div id="names">
         <div>name 1</div>
         <div>name 2</div>
         <div>name 3</div>
    </div>

    <div id="information">
              hereinformation hereinformation hereinformation hereinformation
     </div>
</div>

Open in new window


The above code is not responsive but you could just as easily use % instead of px.  You should really take a look at using a grid and I like bootstrap http://getbootstrap.com/css/.  Since you are moving from tables to divs, this really makes sense.  Bootstrap is a responsive grid and can help you manage desktop and mobile.  When designing responsive pages, you just have to think through more than normal as to how the page looks on each screen size.  You can make bootstrap not responsive as well.  An alternative is http://www.blueprintcss.org/ which is just the css and not all the fancy stuff.  I used to use blueprint a lot and now mostly bootstrap.
0
 
LVL 30

Author Comment

by:Wayne Barron
ID: 39846480
Thanks Scott.
The reason why I used what I did, is it is already setup on the site, for the user-eye-candy that I am using, and need to continue using it as well.
The layout you showed, works great, just not for what i am doing right now.

As for the Bootstrap, that looks really good, however, not what what I am working on at this moment.
However, maybe in the future, as I have a lot of projects in the works for 2014, that it might just come in handy for.

I am going to close this one out.
Accept my last code as Answer, and give you the points for your last post.
As it is very informative.

Have a good one Scott.
Wayne
0
 
LVL 30

Author Closing Comment

by:Wayne Barron
ID: 39858554
I figured out my issue on my own, as listed in the accepted answer.
To Scott, thanks as always, for the great advice.
It will come in very handy sometime in a future 2014 project.

Wayne
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now