Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 01-08-2012, 08:24 AM   #1
Baseband Member
 
Join Date: Nov 2011
Posts: 29
Default Need help with some coding - HTML/CSS

Suppose I've placed two paragraphs, a few headers between the <CENTER> tags...

Now I want to color only the central position of my page such that the entire document appears to be inside a colored block...

Can you pls help...?

Maybe something like this:

<Center>
<p> bla bla </p>
<h2> bla bla...</h2>
etc etc...
.
.
.
.
</center>
__________________

Soumikbhat is offline   Reply With Quote
Old 01-16-2012, 04:47 PM   #2
Baseband Member
 
Join Date: Jan 2012
Location: USA
Posts: 26
Default Re: Need help with some coding - HTML/CSS

<Center>
<p> bla bla </p>
<h2> bla bla...</h2>
etc etc...
.
.
.
.
</center>

Create a div inside the center tag
<center>
<div style="background-color:#fffff">
<p>blabla</p>
<h2>blabla</h2>
etc...
</div>
</center>

For the color code you can use any color picker. There's also an extension for chrome, eyedropper.
__________________

anjen is offline   Reply With Quote
Old 01-27-2012, 03:36 PM   #3
Fully Optimized
 
Bahawolf's Avatar
 
Join Date: May 2005
Location: United States
Posts: 2,604
Default Re: Need help with some coding - HTML/CSS

Better yet, you can use DIVs and CSS to style the block. No more need for the <center> tag at all!

HTML --
<div class="anynameyouwanthere">
<!-- enter your content here -->
</div>

CSS --
.anynameyouwanthere {
width: 500px; /* You can set it to whatever width you need */
margin: 0 auto; /* This is what centers the element! */
background: #fff; /* Set the background color */
color: #000; /* If needed, set the color of the font */
}

Thanks!
Bahawolf is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 11:22 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0