473,654 Members | 2,987 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 3621
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
1823
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 public portal consisting of annotated links to external materials in a particular subject area. - Links on the site will be to materials on separate servers offered through sites of organizations within the institution. There are maybe 2-3000...
4
1524
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 navigation (top), and main content (bottom).
3
23883
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 div, leaving the contents of the other two divs unchanged. But I don't know how to set the "target" property to open in the center div. I would prefer to do this without using frames. Does anybody know how to set the "target" property of each...
1
1881
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
1110
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>"; Thanks!
13
3297
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. Firefox and Safari on the other hand don't treat text-align in that way. In my tests on those browsers, they only centers images and text. Any DIVs, object/embeds or tables remain default unaligned and generally appear on the left. Considering...
1
1351
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) no-repeat center center; } a.visited { background-image: url(img2.jpg); } a.hover { background-image: url(img3.jpg); }
8
7871
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 window it inserts align="center" into the <tabletag, and I get a validation warning that attribute 'align' is considered outdated. Ok, so I probably need to use a CSS style to do the same thing. But I've dug through all of the categories in the...
4
3424
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 frustrated. It says there is an error on line 116. Can someone please help me find this error?!?! This is my code: <?php add_action('init','of_options'); if (!function_exists('of_options')) { function of_options(){
0
8376
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8708
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6161
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
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 we have to send another system

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.