473,505 Members | 15,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Day three of practice, I can't get my syntax right to center these links.

1 New Member
Expand|Select|Wrap|Line Numbers
  1. <div class="link-box">
  2.     <span class="link">
  3.         <a href="home.html">HOME</a>
  4.     </span>
  5.     <span class="link">
  6.         <a href="contact.html">CONTACT</a>
  7.     </span>
  8.     <span class="link">
  9.         <a href="portfolio.html">PORTFOLIO</a>
  10.     </span>
  11. </div>
  12.  
  13. .link-box > #link {
  14. display: flex;
  15. align-items: center;
  16. justify-content: center
  17. }
  18.  
My edits only return black text.
Oct 29 '19 #1
2 3613
gits
5,390 Recognized Expert Moderator Expert
you are using the id-selector (#) but you probably want to use the class-selector (.).
Oct 29 '19 #2
AjayGohil
83 New Member
Hello,Your Code is Right but you use id selector for selecting element in css and in html you use class for defining link.
And you can use below code for centering element inline.

Expand|Select|Wrap|Line Numbers
  1. <div class="link-box">
  2.         <span class="link">
  3.             <a href="home.html">HOME</a>
  4.         </span>
  5.         <span class="link">
  6.             <a href="contact.html">CONTACT</a>
  7.         </span>
  8.         <span class="link">
  9.             <a href="portfolio.html">PORTFOLIO</a>
  10.         </span>
  11.     </div>
  12.  
  13.  
  14. .link-box {
  15. display: flex;
  16. align-items: center;
  17. justify-content: center;
  18. }
  19. .link-box > .link {
  20. padding: 10px;
  21. }
  22.  
Jan 20 '20 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1806
by: pom | last post by:
What dynamnic open-source content management system(s) would you look at to meet the following specific situation? - The requirement is for a large institutional client who wishes to build a...
4
1518
by: Rob Meade | last post by:
Lo all, This is rather embarrassing.... I am having some difficulties with an html table... I have... 1 left nav bar which spans 2 rows to the right - these are used for horizontal...
3
23874
by: Jennifer | last post by:
I have a page with three divs (top, left and center). I want to place hyperlinks in the left column (div), where each link calls a separate page. I want each separate page to open in the center...
1
1870
by: sushjames | last post by:
Here this Syntax doesn't have where clause. SO is it possible to specify a condition without where clause also?. Can someone help me pls. select empname from employess empname like 'jack%';
3
1108
by: Ronald S. Cook | last post by:
How can I write this code so that it will appear as just "Click here" but encoded with the link information? strFile = "Click here"; row = "<a href="http://www.ibm.com>" + strFile + "</a>"; ...
13
3267
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. ...
1
1337
by: SAM | last post by:
Simon Wigzell a écrit : It is a simple question of CSS, no need of JS for that. <style type="text/css"> a img { width: 98px; height: 32px; border: none; } a { background: url(img1/jpg)...
8
7851
by: Bob Altman | last post by:
Hi all, This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page? If I set the table's Align property in the VS 2008 property...
4
3417
by: jhefler | last post by:
Hi, I am new to building my website and tried to insert a google font code into the php code of my wordpress theme, Touchfolio. I keep getting this parse error notification and I am extremely...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.