LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2014, 08:30 PM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
An html tip needed


Hi, I know this is not really a Linux question. Maybe someone knows, I don't know where to ask. I am using Bluefish.

I made a web page with 6 boxes at the top.

Code:
<ul>
<li><a href="index.html">主页<p>Home</p></a></li>
<li><a href="chinese.html">中国家庭<p>Chinese</p></a></li>
<li><a href="english.html">英国互惠生<p>English</p></a></li>
<li><a href="german.html">德国互惠生<p>German</p></a></li>
<li><a href="spanish.html">联系我们<p>Spanish</p></a></li>
<li><a href="references.html">联系我们<p>References</p></a></li>
</ul>

These are governed by mystyle.css

the option 'float' does not have a parameter 'center' only left or right.

I would like the boxes to appear in the centre.

Code:
ul
{
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
}
li
{
float:left;
margin:5px
}
a:link,a:visited
{
display:block;
width:150px;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
text-align:center;
padding:2px;
text-decoration:none;
text-transform:uppercase;
}
a:hover,a:active
{
background-color:#7A991A;
}
body 
{
background-image:url('mypicrl.jpg');
background-repeat:no-repeat; 
background-size:100% ;
background-color:#cccccc;
}
I tried putting <div> just under <body>

Code:
<div class="container">
with

Code:
<style type="text/css">
.container (width 900px; margin-left: auto; margin-right: auto;) 
</style>
But my boxes still stay on the left of the page.

I would like the whole page centred, and then the top boxes with it.

Any tips??
 
Old 06-04-2014, 08:47 PM   #2
lylemwood
Member
 
Registered: Jan 2008
Location: Toronto, Canada
Distribution: Slackware, CentOS
Posts: 47

Rep: Reputation: 18
An html tip needed

Try using margin:auto for the ul.

If you need more help them Google is your friend for many many examples.
 
Old 06-04-2014, 09:37 PM   #3
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Thanks, I set
margin: 0 12%

Works! Maybe there is a better way, but it works!

Google is being blitzed by China at the moment. It is almost impossible to reach, even using vpn!
 
Old 06-05-2014, 02:28 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 06-05-2014, 10:49 PM   #5
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Rep: Reputation: 29
Untested, but it is what I would try first.
Code:
<div align="center">
<ul>
<li><a href="index.html">主页<p>Home</p></a></li><br>
<li><a href="chinese.html">中国家庭<p>Chinese</p></a></li><br>
<li><a href="english.html">英国互惠生<p>English</p></a></li><br>
<li><a href="german.html">德国互惠生<p>German</p></a></li><br>
<li><a href="spanish.html">联系我们<p>Spanish</p></a></li><br>
<li><a href="references.html">联系我们<p>References</p></a></li>
</ul>
</dir>>
 
Old 06-05-2014, 11:24 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,224

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by Pedroski View Post
Google is being blitzed by China at the moment. It is almost impossible to reach, even using vpn!
June 4th? I have no idea why that would happen on that date.

Anyway, this is currently one of the best CSS guides:

http://adamschwartz.co/magic-of-css/

Last edited by dugan; 06-05-2014 at 11:46 PM.
 
1 members found this post helpful.
Old 06-08-2014, 06:04 AM   #7
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
I got around the problem by using a 1 cell table

Code:
<table cellpadding="5" cellspacing="0" width="80%"><tr><td>
and in the css

Code:
body 
{

margin-left: 10%;
Probably not the most elegant solution, but it works!

Thanks for the tips. I like the css link. I will read it very carefully!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Tip: Tip: Simple Regular Expressions For Reviewing Log Files LXer Syndicated Linux News 0 11-20-2008 12:41 PM
html/php editor - advice needed oskar Linux - Software 1 01-22-2007 05:09 PM
c++ html parser needed gecoool Programming 1 11-07-2005 09:47 PM
Tip`s needed on vncserver aerogate Mandriva 1 07-23-2005 11:08 AM
HTML editor and FTP client for Slack needed... Focalpoint Linux - Newbie 4 07-06-2004 09:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration